Skip to content

Instantly share code, notes, and snippets.

@eagsalazar
Created July 12, 2016 05:36
Show Gist options
  • Save eagsalazar/791d0e2fb8c5ee9a5a3d705441560dfe to your computer and use it in GitHub Desktop.
Save eagsalazar/791d0e2fb8c5ee9a5a3d705441560dfe to your computer and use it in GitHub Desktop.
function tempRedirect(req, res) {
var filename = req.params[0];
var params = {
Bucket: S3_BUCKET,
ResponseContentDisposition: 'inline; filename=' + filename.replace(/,/, '_'),
Key: checkTrailingSlash(getFileKeyDir(req)) + filename
};
var s3 = new aws.S3(s3Options);
s3.getSignedUrl('getObject', params, function(err, url) {
res.redirect(url);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment