Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to upload a file by passing a readable stream #98

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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