| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Could a buffer(stream) function also be added? |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. I think error and type checking is done indirectly.
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
|
What happens if the functions are called on object streams? |
Sorry, something went wrong.
Sorry, something went wrong.
For blob(), buffer() and arrayBuffer(), the object is coerced using toString() rules. For text() and json() the promises reject because the objects cannot be decoded as utf8 byte sequences. I've extended the tests accordingly. |
Sorry, something went wrong.
Signed-off-by: James M Snell <jasnell@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #39594 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #39594 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
|
I wished that buffer() wasn't added I'm a bit biased towards Buffer in general cuz it isn't cross env friendly. and it's bloated with stuff TextEncoder and DataView is suppose to solve for you when working with typed arrays |
Sorry, something went wrong.
|
Would it be optimizable if arrayBuffer() had a totalLength option too? There would not be pkg like this otherwise that don't need to take up twice the size when it's time to concatinate: |
Sorry, something went wrong.
|
Like #39134, this needs a volunteer to backport to v16.x-staging. |
Sorry, something went wrong.
|
I'm willing to take care of it. |
Sorry, something went wrong.
|
Isn't it already good? |
Sorry, something went wrong.
|
@Mesteery you're right, sorry. It looks like the backport-requested label was added by mistake |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
@mcollina @ronag ... here's an alternative approach to the Body mixin stuff. Rather than providing the Body mixin directly, these introduce utility functions that can be used by the ecosystem to provide those basic methods, at least in part.
For a very rudimentary example...
These work with ReadableStream, stream.Readable, and async interables.
There's likely a bit more error handling that could be added but I wanted to at least open the PR to give a basic idea.