Skip to content

Progress events

Choose a tag to compare

@sergi sergi released this 13 Jul 09:07
· 152 commits to master since this release

Whenever you use get or put now the Ftp object will emit a progress event telling you how much of the current file has been transferred, along with some other info.

Example of usage:

ftp.on('progress', function(data) {
  console.log('Transferred ' + data.transferred + 'bytes of ' + data.total);
  // There is also a data.filename and data.action properties, 
  // to know the name of the file currently being transferred 
  // and whether it is a 'get' or 'put' action.
});

ftp.put('test.txt', '/remote/folder', function(err, res) {
  if (!err) console.log('Transfer complete!');
});

Thanks to Sergio Lopez for suggesting to implement this!

Also, unit test code has been made more robust in this release.