BinWrapper.prototype._get = function (cb) { var files = this._parse(this.src()); var self = this; var Download = require('download'); var download = new Download({ extract: true, mode: 755, strip: this.opts.strip }); files.forEach(function (file) { download.get(file.url); }); download .dest(this.dest()) .use(status()) .run(function (err) { if (err) { cb(err); return; } cb(); }); };
mkdirp(directoryPath, function(err, madePath) { if (err) { throw err; } else { /** * let's add the info.json file */ fileSystem.writeFileSync(madePath + '/info.json', JSON.stringify(bible.version_info)); /** * Let's create the about.html file */ fileSystem.writeFileSync(madePath + '/about.html', bible.about); /** * Now download all the files */ display('Downloading the usfm files... This may take a while... Go grab a cup of coffee...'); //noinspection JSPotentiallyInvalidConstructorUsage var fileDownload = new download({}); for (var f = 0; f < bible.files.length; f++) { fileDownload.get(bible.files[f]); } fileDownload.dest(madePath); fileDownload.run(); } });
return new Promise((resolve, reject) => { console.info(`[${project.uid}] downloading assets...`); // create downloader let downloader = new Download(); // set download path downloader.dest(project.workpath); // iterate over each asset for (let asset of project.assets) { downloader.get(asset.src); // check for custom project if (asset.type === 'project') { project.template = asset.name; } } // run download and return downloader.run((err, files) => { return (err) ? reject(err) : resolve(project); }); });
BinBuild.prototype.run = function (cb) { cb = cb || function () {}; var commands = this.cmd(); var tmp = tempfile(); var download = new Download({ strip: this.opts.strip, extract: true, mode: '777' }); download.get(this.src()); download.dest(tmp); download.run(function (err) { if (err) { cb(err); return; } execSeries(commands, { cwd: tmp }, function (err) { if (err) { cb(err); return; } rm(tmp, cb); }); }); };
module.exports.downloadFiles = function (urls, dest, callback) { var download = new Download(); urls.forEach(function (url) { download.get(url); }); download.dest(dest). use(progress()); download.run(callback); };
BinBuild.prototype.get = function (cb) { var download = new Download({ strip: this.opts.strip, extract: true, mode: '777' }); download.get(this.src()); download.dest(this._tmp); download.run(cb); };
exports.downloadFiles = function(urls, dest, callback) { // Moved these to inside the function so they will lazy load. var Download = require('download'); var progress = require('download-status'); var download = new Download(); urls.forEach(function(url) { download.get(url); }); download.dest(dest).use(progress()); download.run(callback); };
BinWrapper.prototype.get = function (cb) { var files = this.parse(this.src()); var download = new Download({ extract: true, mode: '755', strip: this.opts.strip }); files.forEach(function (file) { download.get(file.url); }); if (this.opts.progress) { download.use(status()); } download.dest(this.dest()); download.run(cb); };