-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(response): add sendIterable
util
#655
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #655 +/- ##
==========================================
+ Coverage 77.83% 78.14% +0.31%
==========================================
Files 47 53 +6
Lines 4286 4970 +684
Branches 611 661 +50
==========================================
+ Hits 3336 3884 +548
- Misses 933 1067 +134
- Partials 17 19 +2 β View full report in Codecov by Sentry. |
@pi0 A note worth mentioning in the docs is that the default buffering for server responses is per 16k bytes. So users may be surprised that the first This is a bit unfortunate for the primary use case to have live output for a long-running process, but by mentioning it users can either work around it (by somehow creating a different buffer for the node server) or accepting the limitation. See also unjs/listhen#161 |
π Linked issue
#581
β Type of change
π Description
Introduces a new utility function
sendIterable
, relevant types and an additional helper function are also exposed.Newly exposed API:
The new feature allows users of h3 (and by extension Nitro and Nuxt) to write generator functions (
function*(){}
) that produce a response piece-by-piece. For more reason on justification see the linked issue.Resolves #581
π Checklist