s3 upload node js code example
Example 1: how to download array of files from aws s3 using aws sdk in nodejs
const exec = require('child_process').exec;
exec('aws s3 sync s3://yourbucket .', (err, stdout, stderr) => {});
Example 2: how to download array of files from aws s3 using aws sdk in nodejs
function listFiles(cb) {
s3.stuff(params, cb);
}
function downlaodFile(key, cb) {
s3.stuff(key, cb);
}
listFiles(function (err, fileKeys) {
if (err) {
throw err;
}
async.each(fileKeys, downloadFile, function done(err) {
if (err) {
throw err;
}
});
});