Created
October 31, 2017 19:51
-
-
Save psbolden/b2324b1fec5666668bab4ad49761039f to your computer and use it in GitHub Desktop.
aws knox upload from url / set expiring url
This file contains hidden or 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
var filename = "/imagename.jpg"; | |
var url = "http://imageurl.jpg"; | |
http.get(url , function(res){ | |
var headers = { | |
'Content-Length': res.headers['content-length'] | |
, 'Content-Type': res.headers['content-type'] | |
}; | |
client.putStream(res, filename, headers, function(err, res){ | |
var expires = new Date(); | |
expires.setMinutes(expires.getMinutes() + 10); | |
var url = client.signedUrl(filename, expires); | |
console.log(url); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment