UNPKG

gitly

Version:

An API to download and/or extract git repositories

28 lines (27 loc) 1.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = gitly; const clone_1 = __importDefault(require("./clone")); const download_1 = __importDefault(require("./download")); const extract_1 = __importDefault(require("./extract")); /** * Downloads and extracts the repository * @param repository The repository to download * @param destination The destination to extract * @returns A tuple with the source and destination respectively */ async function gitly(repository, destination, options) { let source = ''; switch (options === null || options === void 0 ? void 0 : options.backend) { case 'git': source = await (0, clone_1.default)(repository, options); break; default: source = await (0, download_1.default)(repository, options); break; } return [source, await (0, extract_1.default)(source, destination, options)]; }