Skip to content

Instantly share code, notes, and snippets.

@psbolden
Created October 31, 2017 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psbolden/b2324b1fec5666668bab4ad49761039f to your computer and use it in GitHub Desktop.
Save psbolden/b2324b1fec5666668bab4ad49761039f to your computer and use it in GitHub Desktop.
aws knox upload from url / set expiring url
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