Created
July 12, 2016 05:36
-
-
Save eagsalazar/791d0e2fb8c5ee9a5a3d705441560dfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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