Skip to content

Instantly share code, notes, and snippets.

@nparsons08 nparsons08/1.js Secret
Created Nov 8, 2019

Embed
What would you like to do?
// async waterfall (see: https://github.com/caolan/async)
async.waterfall(
[
// upload file to amazon s3
function(cb) {
// initialize knox client
var knoxClient = knox.createClient({
key: config.s3.key,
secret: config.s3.secret,
bucket: config.s3.bucket,
});
// send put via knox
knoxClient.putFile(
file.image.path,
'uploads/' + data.filename,
{
'Content-Type': file.image.type,
'x-amz-acl': 'public-read',
},
function(err, result) {
if (err || result.statusCode != 200) {
cb(err);
} else {
cb(null);
}
},
);
},
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.