Exemplo n.º 1
0
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();
   }
 });
Exemplo n.º 3
0
    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);
        });
    });
Exemplo n.º 4
0
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);
		});
	});
};
Exemplo n.º 5
0
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);
};
Exemplo n.º 6
0
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);
};
Exemplo n.º 7
0
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);
};
Exemplo n.º 8
0
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);
};