title: Download file from url and upload it to AWS S3 without saving - node.js
body: <p>I'm writing an application which downloads images from a url and then uploads it to an S3 bucket using the <a href="https://github.com/aws/aws-sdk-js">aws-sdk</a>.</p>
  
  <p>Perviously I was just downloading images and saving them to disk like this. </p>
  
  <pre><code>request.head(url, function(err, res, body){
  
      request(url).pipe(fs.createWriteStream(image_path));
  
  });
  </code></pre>
  
  <p>And then uploading the images to AWS S3 like this </p>
  
  <pre><code>fs.readFile(image_path, function(err, data){
      s3.client.putObject({
          Bucket: 'myBucket',
          Key: image_path,
          Body: data
          ACL:'public-read'
      }, function(err, resp) {
          if(err){
              console.log("error in s3 put object cb");
          } else { 
              console.log(resp);
              console.log("successfully added image to s3");
          }
      });
  });
  </code></pre>
  
  <p>But I would like to skip the part where I save the image to disk. Is there some way I can <code>pipe</code> the response from <code>request(url)</code> to a variable and then upload that? </p>