Skip to content

Conversation

@faressoft
Copy link

@faressoft faressoft commented Jun 8, 2016

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');

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant