---
title: "Comment by Stasa Stanisic on \"A guide to reading and writing Node.js streams\" | Hashnode"
description: "Thank you for a great streams overview! How would you write out the correct version of HTTP stream example with stream/promises pipeline, pass res as last param"
url: "https://hashnode.com/posts/a-guide-to-reading-and-writing-nodejs-streams/668fd751e5d695eed5680b4d/comment/669bc4c5e7c7f0d1d346a3c6"
---

[Discussion](https://hashnode.com/posts/a-guide-to-reading-and-writing-nodejs-streams/668fd751e5d695eed5680b4d)

Comment [A guide to reading and writing Node.js streams](https://hashnode.com/posts/a-guide-to-reading-and-writing-nodejs-streams/668fd751e5d695eed5680b4d)

[Stasa Stanisic](https://hashnode.com/@stasas)

[Jul 20, 2024](https://hashnode.com/posts/a-guide-to-reading-and-writing-nodejs-streams/668fd751e5d695eed5680b4d/comment/669bc4c5e7c7f0d1d346a3c6)

Thank you for a great streams overview!

How would you write out the correct version of HTTP stream example with stream/promises pipeline, pass res as last parameter? And for fastify, reply.send?

[Matteo Collina](https://hashnode.com/@matteocollina)

Open Sourcerer, Node.js TSC member, Fastify Lead Maintainer

[Jul 25, 2024](https://hashnode.com/posts/a-guide-to-reading-and-writing-nodejs-streams/668fd751e5d695eed5680b4d/comment/669bc4c5e7c7f0d1d346a3c6#reply-66a223b1f67fe113f8fcb4d2)

use `@fastify/static` :). Don't stream files directly because there are infinite edge cases that will inevitably result in a security issues in your server.

[Stasa Stanisic](https://hashnode.com/@stasas)

[Jul 25, 2024](https://hashnode.com/posts/a-guide-to-reading-and-writing-nodejs-streams/668fd751e5d695eed5680b4d/comment/669bc4c5e7c7f0d1d346a3c6#reply-66a22736f9ee50415797da53)

[Matteo Collina](https://hashnode.com/@matteocollina) Thanks for the reply! Yes, understood for static files which can be directly served, but I was thinking more of the case when there is a pipeline - reading file then transforming and finally sending as a response...

[Matteo Collina](https://hashnode.com/@matteocollina)

Open Sourcerer, Node.js TSC member, Fastify Lead Maintainer

[Jul 25, 2024](https://hashnode.com/posts/a-guide-to-reading-and-writing-nodejs-streams/668fd751e5d695eed5680b4d/comment/669bc4c5e7c7f0d1d346a3c6#reply-66a2459182434a49dc324bcc)

[Stasa Stanisic](https://hashnode.com/@stasas) you can just call `reply.send(stream)` or `return stream` in your Fastify route. Using barebone HTTP, you should do `pipeline(a, b, c, res, (err) => { ... })`.
