title: Download image from S3 bucket to Lambda temp folder (Node.js)
body: <p>Good day guys.</p>
  
  <p>I have a simple question: <strong>How do I download an image from a S3 bucket to Lambda function temp folder for processing</strong>? Basically, I need to attach it to an email (this I can do when testing locally).</p>
  
  <p>I have tried:</p>
  
  <pre><code>s3.download_file(bucket, key, '/tmp/image.png')
  </code></pre>
  
  <p>as well as (not sure which parameters will help me get the job done):</p>
  
  <pre><code>s3.getObject(params, (err, data) =&gt; {
      if (err) {
          console.log(err);
          const message = `Error getting object ${key} from bucket ${bucket}.`;
          console.log(message);
          callback(message);
      } else {
  
          console.log('CONTENT TYPE:', data.ContentType);
          callback(null, data.ContentType);
      }
  });
  </code></pre>
  
  <p>Like I said, simple question, which for some reason I can't find a solution for.</p>
  
  <p>Thanks!</p>