Skip to content

Instantly share code, notes, and snippets.

@banjeremy
Created June 15, 2016 19:15
Show Gist options
  • Save banjeremy/f09410d8ba328f4a6151791afe2a9189 to your computer and use it in GitHub Desktop.
Save banjeremy/f09410d8ba328f4a6151791afe2a9189 to your computer and use it in GitHub Desktop.
stream file to s3 using node.js
const S3 = require('aws-sdk').S3;
const fs = require('fs');
const body = fs.createReadStream('./my-file.txt');
const s3 = new S3();
s3.upload({
Bucket: 'my-bucket',
Key: 'my-directory/my-file.txt',
Body: body
}, (err, data) => {
console.log(err, data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment