@ibaraki-douji/anime4k
Version:
Upscale Videos using Anime4KCPP
34 lines (33 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Seven = require("node-7z");
const fs_1 = require("fs");
const node_fetch_1 = require("node-fetch");
const path_1 = require("path");
const sevenBin = require("7zip-bin");
const dir = path_1.resolve(__dirname, '..');
console.log("Downloading and installing Anime4k");
(async () => {
let zipURL = "";
// REMOVE EXISTING 4K
if (fs_1.existsSync(dir + "/anime4k"))
fs_1.rmdirSync(dir + "/anime4k", { recursive: true });
// URL PLATFORM
if (process.platform == "win32")
zipURL = "https://github.com/TianZerL/Anime4KCPP/releases/download/v2.5.0/Anime4KCPP_CLI-2.5.0-Win64-msvc.7z";
else
throw new Error("This lib not support " + process.platform);
// DOWNLOAD 4K
const zipRes = await node_fetch_1.default(zipURL);
const zip = await zipRes.buffer();
// INSTALL 4K
fs_1.writeFileSync(path_1.resolve(dir, "zip.7z"), zip);
Seven.extractFull(path_1.resolve(dir, "zip.7z"), path_1.resolve(dir), {
$bin: sevenBin.path7za,
yes: true
}).on("end", () => {
fs_1.unlinkSync(dir + "/zip.7z");
// RENAME FOLDER
fs_1.renameSync(dir + "/CLI", dir + "/anime4k"); /** */
});
})();