It is not a good idea to upload files using buffers that must be loaded into the memory before they can be passed to the .put() method to upload them, especially with very large files which exceeds the memory size.
So, I have added the ability to the .put() method to receive either a buffer(or string) or a readable stream without breaking the .put() api, so my changes is compatible with any previous usage of the method.
client.put(remoteFilePath, fs.createReadStream(localFilePath), function(status, reply) {
if (status !== 200) {
return exit('Uplading is failed');
}
exit('Done');
});
It is not a good idea to upload files using buffers that must be loaded into the memory before they can be passed to the .put() method to upload them, especially with very large files which exceeds the memory size.
So, I have added the ability to the .put() method to receive either a buffer(or string) or a readable stream without breaking the .put() api, so my changes is compatible with any previous usage of the method.