title: Read file from S3 into a buffer
body: <p>I am trying to write a function in Lambda that requires a file from S3 to be read into a buffer. I have seen multiple examples of them being read into streams but none with buffers. My current code for getting the object is</p>
  
  <pre><code>exports.handler = async (event, context, callback) =&gt; {
  
      //console.log("Reading options from event:\n", util.inspect(event, {depth: 5}));
      const srcBucket = event.Records[0].s3.bucket.name;
      const srcKey    = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " "));
  
      const params = 
          {
              Bucket: srcBucket,
              Key: srcKey
          };
  
      try 
      {
          var slippiGame = s3.getObject(params, function(error, data) 
          {
              if (error)
              {
                  console.log(error);
              }
              else
              {
                  const game = new SlippiGame(slippiGame);
              }
          });
      } 
      catch (e) 
      {
          console.log("fail");
          console.log(e);
      }
  
      console.log(slippiGame);
  
      return("success");
  };
  </code></pre>
  
  <p>I know that this approach is wrong since my slippiGame variable isn't a buffer and the SlippiGame constructor only takes a local file or a buffer. Is there a way to either store the file from S3 temporarily in the Lambda directory or create a buffer to hold the S3 file in?</p>