UNPKG

twokeys-server

Version:

Server for 2Keys

33 lines 1.44 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const zip_downloader_1 = __importDefault(require("./zip-downloader")); const constants_1 = require("../../util/constants"); const path_1 = require("path"); const copy_contents_1 = __importDefault(require("../../util/copy-contents")); const logger_1 = __importDefault(require("../../util/logger")); const logger = new logger_1.default({ name: "software" }); /** * Downloader * @param argv Args from CLI */ async function fetch_software(argv) { return new Promise(async (resolve, reject) => { try { const ahk = new zip_downloader_1.default("ahk", constants_1.AHK_DOWNLOAD_PATH, path_1.join(constants_1.DEFAULT_USERSPACE_SOFTWARE_DOWNLOAD, `ahk-${constants_1.AHK_VERSION}`), `ahk-${constants_1.AHK_VERSION}.zip`, argv); await ahk.fetch_file(); await ahk.extract(); await copy_contents_1.default(path_1.join(ahk.saveTo, `ahkdll-v${constants_1.AHK_VERSION.split(".")[0]}-release-master`), path_1.join(constants_1.DEFAULT_USERSPACE_SOFTWARE_PATHS.ahk.root)); resolve(); } catch (err) { logger.throw(err); } }); } exports.default = fetch_software; //# sourceMappingURL=index.js.map