@ryanburnette/s3-upload-file
v1.3.0
Published
Upload a file to AWS S3 using Node.js.
Downloads
3
Readme
s3-upload-file
Upload a file to AWS S3 using Node.js.
Usage
require('@ryanburnette/s3-upload-file')({
// optional cwd to keep paths relative
cwd: 'demo/',
// path to file relative to project or cwd
filePath: 'dir/file.txt',
// https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html
s3: new require('aws-sdk').S3(),
// uploadOpts will be passed to S3.upload
// Key and Body will be set for you
// Bucket must be provided
// ContentType will be set for you if not provided here
uploadOpts: {
Bucket: 'my-bucket'
},
// optionally prefix the remote path
remotePathPrefix: 'foo'
}).then(function(result) {
console.log(result);
});