title: How to stream file to s3 from url
body: <p>How do I grab a file from a url and then upload to s3? There are alot of examples using Multipart Upload out there but this should be simpler.This code executes server side. S3 upload fails with 'NetworkingError: Cannot pipe. Not readable.' </p>
  
  <pre><code>import http from 'http';
  import fs from 'fs';
  import AWS from 'aws-sdk';
  AWS.config.region = 'us-west-1';
  
  const file = fs.createWriteStream('file.jpg');
  var request = http.get('http://weknowmemes.com/wp-content/uploads/2012/04/dont-worry-cat-it.jpg', function(response) {
    response.pipe(file);
  
    file.on('finish', function() {
      // Upload the File
      var s3 = new AWS.S3({params: {Bucket: Config.s3Bucket}});
      var params = {Key: 'mykey', ContentType: 'image/jpg', Body: file};
      s3.putObject(params, function (err, data) {
        console.log('err', err)
        console.log('data', data)
      });
    });
  });
  </code></pre>