-
-
Notifications
You must be signed in to change notification settings - Fork 194
Open
Description
Currently send does not implement the Streams API (even if it inherits from Stream), and in fact inside send(..).pipe(res), it does stream.pipe(res).
Specifically, we had to use an "hack" to make it work well on Fastify. See fastify/fastify-static#46, where we had to pipe it through a modified PassThrough.
I'm thinking of changing the API to something:
const { stream, headers, statusCode } = await send(req, path, options)As well as:
send(req, path, options, (err, { stream, headers, statusCode }) => {
// ...
})I would like to also remove the dependency on on-finished and some of the others modules that were needed in the 0.8/0.10 days.
I think this work should help as well with http2 compatibility as well. I'm happy to prototype this work in a forked module as well, just let me know.
cc @apapirovski