I'm very new to streams in NodeJS - basically clueless about them - and I'm trying to get the KnoxJS client for Amazon S3 to stream a file from an HTTP GET.
The sample code on the Knox github page shows this:
http.get('http://google.com/doodle.png', function(res){
var headers = {
'Content-Length': res.headers['content-length']
, 'Content-Type': res.headers['content-type']
};
client.putStream(res, '/doodle.png', headers, function(err, res){
// check `err`, then do `res.pipe(..)` or `res.resume()` or whatever.
});
});
But this is very clearly incomplete... it really doesn't do much of anything other than open the http.get
and putStream
for S3.
So where do I go from here? Can someone help me complete this code so that I can stream a file from an HTTP GET to my bucket on S3?