title: Piping a file straight to the client using Node.js and Amazon S3
body: <p>So I want to pipe a file straight to the client; how I am currently doing it is create a file to disk, then sending that file straight to the client.</p>
  
  <pre><code>router.get("/download/:name", async (req, res) =&gt; {
  
    const s3 = new aws.S3();
    const dir = "uploads/" + req.params.name + ".apkg"
    let file = fs.createWriteStream(dir);
  
    await s3.getObject({
      Bucket: &lt;bucket-name&gt;,
      Key: req.params.name + ".apkg"
    }).createReadStream().pipe(file);
  
    await res.download(dir);
  });
  </code></pre>
  
  <p>I just looked up that <code>res.download()</code> only serves locally. Is there a way you can do it directly from AWS S3 to Client download? i.e. pipe files straight to user. Thanks in advance</p>