You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In common practices with streaming APIs, A.pipe(B) means "pipe the readable stream A to B." However, the Hono streaming helper API stream.pipe(A) means "pipe the readable stream A to the stream` and it goes against the practices. This confused me when I first saw it.
I suggest renaming pipe method to drain, as it reflects the actual behavior if keeping that API shape.
Anyway, since Hono can directly return readable streams from handlers, I don't fully get its use cases yet. Is it intended for manipulating and combining streams imperatively?
Edit:
I found some articles providing example code that uses the stream() helper to just respond with a readable stream, From what I understand so far, the stream() helper is used similarly to c.text() and c.json() API. If so, there may be a streamOf(readable) or stream(readable) API for the simple purpose just returning a readable stream.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In common practices with streaming APIs,
A.pipe(B)
means "pipe the readable stream A to B." However, the Hono streaming helper APIstream.pipe(A)
means "pipe the readable stream A to the stream` and it goes against the practices. This confused me when I first saw it.I suggest renaming
pipe
method todrain
, as it reflects the actual behavior if keeping that API shape.Anyway, since Hono can directly return readable streams from handlers, I don't fully get its use cases yet. Is it intended for manipulating and combining streams imperatively?
Edit:
I found some articles providing example code that uses the
stream()
helper to just respond with a readable stream, From what I understand so far, thestream()
helper is used similarly toc.text()
andc.json()
API. If so, there may be astreamOf(readable)
orstream(readable)
API for the simple purpose just returning a readable stream.Beta Was this translation helpful? Give feedback.
All reactions