Light and complete FTP client implementation for Node.js
This release fixes bug https://github.com/sergi/jsftp/issues/54, which would cause concurrent code such as:
ftp.ls(path1, function showFile(err, res) {
if (err) return console.log(err);
console.log(res[0].name);
});
ftp.ls(path2, function showFile(err, res) {
if (err) return console.log(err);
console.log(res[0].name);
});
Would always show the same result, because items in the queue haven't been shifted.
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.
This release accomplishes the following:
BIG Warning: This version of jsftp breaks API compatibility with previous versions, it is NOT a drop-in replacement. Please be careful when upgrading. The API changes are not drastic at all and it is all documented below. If you do not want to upgrade yet you should stay with version 0.6.0, the last one before the upgrade. The API docs are updated for 1.0
This release accomplishes the following:
BIG Warning: This version of jsftp breaks API compatibility with previous versions, it is NOT a drop-in replacement. Please be careful when upgrading. The API changes are not drastic at all and it is all documented below. If you do not want to upgrade yet you should stay with version 0.6.0, the last one before the upgrade. The API docs are updated for 1.0