s3-transload
v1.0.0
Published
GET file from link and upload to AWS S3
Downloads
9
Maintainers
Readme
s3-transload
A module that pipe network file into AWS S3. Recommended to use with node 6+, as it is using some ES6 feature.
What this module do?
- GET a file from the provide url and stream to S3
Example
const AWS = require("aws-sdk");
const s3Transload = require("s3-transload");
// setup S3 credential
var credentials = new AWS.SharedIniFileCredentials({profile: 'your-profile'});
AWS.config.credentials = credentials;
const s3 = new AWS.S3({
apiVersion: "2006-03-01"
});
const { urlToS3 } = s3Transload(s3);
const util = require("util");
const urlToS3Promise = util.promisify(urlToS3);
urlToS3Promise("http://path/to/the/resource", {
Bucket: "your-bucket-name",
Key: "your-item-key"
}).then(result => {
console.log(result);
});