-
Notifications
You must be signed in to change notification settings - Fork 664
feat(streams): new LimitDelimiterStream() #6890
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6890 +/- ##
=======================================
Coverage 94.11% 94.12%
=======================================
Files 581 582 +1
Lines 42707 42763 +56
Branches 6796 6804 +8
=======================================
+ Hits 40194 40250 +56
Misses 2463 2463
Partials 50 50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Is there a particular use case for this stream? |
Yes. I'd like to offer a streaming FormData encoder and decoder and in it I found something like this useful. The normal DelimiterStream isn't suitable as it would likely produce huge chunks, possibly too big, when processing the files defeating the purpose of streaming.
I'd need you to be more specific on what this
I'm not attached to the name and open to suggestions if you think there is something better to communicate its intended behaviour. |
Sounds interesting to me. Can you add some note about such situation in API doc? (An example illustrating that situation would aslo be very helpful.) |
|
I added a note explaining more, but I can't really think of an example that's simple to demonstrate the point. |
This pull request offers a new
TransformStreaminto the mix. While we do already haveDelimiterStream, it isn't suitable if your delimiter is unlikely to appear for long stretches of bytes, meaning you could end up with huge chunks at a time. This pull request offersLimitDelimiterStreamwhich as the name implies, offers a maximum length that a chunk can be.Example