UNPKG

crunchy

Version:

Crunchy is a fork of Crunchyroll.js, capable of downloading anime episodes from the popular CrunchyRoll streaming service.

72 lines 2.19 kB
'use strict'; exports.__esModule = true; var fs = require("fs-extra"); var path = require("path"); var configFile = path.join(process.cwd(), 'config.json'); function fileExist(path) { try { fs.statSync(path); return true; } catch (e) { return false; } } function load() { if (fileExist(configFile)) { var data = fs.readFileSync(configFile, 'utf8'); return JSON.parse(data); } return { args: undefined }; } exports.load = load; function save(config) { var tmp = JSON.parse(JSON.stringify(config)); // Things added by the command line parser tmp.rawArgs = undefined; tmp.options = undefined; tmp._execs = undefined; tmp._args = undefined; tmp._name = undefined; tmp._version = undefined; tmp._versionOptionName = undefined; tmp._events = undefined; tmp._eventsCount = undefined; tmp.args = undefined; tmp.commands = undefined; tmp._allowUnknownOption = undefined; tmp.parent = undefined; tmp._scriptPath = undefined; tmp._optionValues = undefined; tmp._storeOptionsAsProperties = undefined; tmp._passCommandToAction = undefined; tmp._actionResults = undefined; tmp._actionHandler = undefined; tmp._executableHandler = undefined; tmp._executableFile = undefined; tmp._defaultCommandName = undefined; tmp._exitCallback = undefined; tmp._alias = undefined; tmp._noHelp = undefined; tmp._helpFlags = undefined; tmp._helpDescription = undefined; tmp._helpShortFlag = undefined; tmp._helpLongFlag = undefined; tmp._hasImplicitHelpCommand = undefined; tmp._helpCommandName = undefined; tmp._helpCommandnameAndArgs = undefined; tmp._helpCommandDescription = undefined; // Things we don't want to save tmp.cache = undefined; tmp.episodes = undefined; tmp.series = undefined; tmp.rebuildcrp = undefined; tmp.batch = undefined; tmp.verbose = undefined; tmp.debug = undefined; tmp.unlog = undefined; tmp.ignoredub = undefined; fs.writeFileSync(configFile, JSON.stringify(tmp, null, ' ')); } exports.save = save; //# sourceMappingURL=config.js.map