Created
June 15, 2016 19:15
-
-
Save banjeremy/f09410d8ba328f4a6151791afe2a9189 to your computer and use it in GitHub Desktop.
stream file to s3 using node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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