Sha256: cd55d526abed230299c403afcff8261824f0c59ac3ffac053b5d3cb88a044afd

Contents?: true

Size: 1.07 KB

Versions: 62

Compression:

Stored size: 1.07 KB

Contents

'use strict';
var fs = require('fs');
var request = require('request');
var tmp = require('tmp');
var exec = require('child_process').exec;
var path = require('path');

var url = 'https://drive.google.com/uc?id=0Bxxp2pVhWG1DTFNWQ1hsSkZKZmM&export=download';

var errorHandler = function (err) {
    throw err;
};

var extract = function (filename) {
    exec('tar -xvzf ' + filename, {
        cwd: path.join(__dirname, 'test'),
        maxBuffer: 1024 * 1024
    }, function (err, stdout, stderr) {
        if (err) {
            throw err;
        }

        console.log('Done');
    });
};

tmp.file({
    prefix: 'assets',
    postfix: '.tgz'
}, function (err, filename, fd) {
    console.log('Downloading ' + url + ' to ' + filename);

    var read = request(url);
    var write = fs.createWriteStream(filename);

    read.on('error', errorHandler);
    write.on('error', errorHandler);

    // For node 0.8 we can't just use the 'finish' event of the pipe
    read.on('end', function () {
        write.end(extract.bind(null, filename));
    });

    read.pipe(write, {end: false});
});

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/decompress-zip/download-test-assets.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/decompress-zip/download-test-assets.js