Tuesday 11 April 2017

Downloading progress in Google Drive

In my Meteor server app, I am downloading a file from Google Drive using this code,

var dest = fs.createWriteStream('/data/'+data.name);
        drive.files.get({
           fileId: data.id,
           alt: 'media',
           auth: jwtClient
        })
        .on('end', Meteor.bindEnvironment(function() {

        }))
        .on('error', function(err) {
          console.log('Error during download', err);
        })
        .pipe(dest);

How can I get the progress of the download? For example, i want every 30 seconds to display progress of the download using console.log()

Can I use .on('data')? I am using google drive nodejs v3 provided by Google.



via JMA

No comments:

Post a Comment