Yagiz Nizipli
f720c5880e
stream: use ArrayBufferPrototypeGetByteLength
...
PR-URL: https://github.com/nodejs/node/pull/45528
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-11-24 11:46:22 -05:00
Yagiz Nizipli
c00258e24b
stream: add primordials to adapters
...
PR-URL: https://github.com/nodejs/node/pull/45511
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2022-11-21 15:20:47 -05:00
Kohei Ueno
496912d722
stream: fix typo in adapters.js ( #45515 )
...
`isReadableNodestream` -> `isReadableNodeStream`
PR-URL: https://github.com/nodejs/node/pull/45515
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-11-21 15:20:45 -05:00
Yagiz Nizipli
8d96e2c723
stream: add fast path for utf8
...
PR-URL: https://github.com/nodejs/node/pull/45483
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2022-11-21 15:20:41 -05:00
Jithil P Ponnan
bc0ae3e74e
stream: fix web streams have no Symbol.toStringTag
...
stream: fix web streams have no Symbol.toStringTag
stream: add unit tests
PR-URL: https://github.com/nodejs/node/pull/45117
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-11-10 09:42:59 -03:00
David Halls
1655532fd2
stream: don't push null from closed promise #42694
...
closed promise is subscribed to first so will be
resolved first, before any read promise.
This causes data after EOF error to be thrown.
Remove the push null from the closed promise handler.
The push null gets done from the read handler
when it detects done.
PR-URL: https://github.com/nodejs/node/pull/45026
Fixes: https://github.com/nodejs/node/issues/42694
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-11-10 09:42:58 -03:00
Antoine du Hamel
c7b7f2bec2
lib: add lint rule to protect against Object.prototype.then pollution
...
PR-URL: https://github.com/nodejs/node/pull/45061
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-11-10 09:42:58 -03:00
Daeyeon Jeong
3fdf6cfad9
stream: fix size function returned from QueuingStrategies
...
The `size` function returned from the `size` getter of
`ByteLengthQueuingStrategy` or `CountQueuingStrategy` should not have
a prototype property, nor be a constructor.
Refs: https://streams.spec.whatwg.org/#blqs-size
Refs: https://streams.spec.whatwg.org/#cqs-size
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/44867
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-10-12 10:26:35 +00:00
Daeyeon Jeong
43e2f60be0
stream: handle enqueuing chunks when a pending BYOB pull request exists
...
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/44770
Refs: https://streams.spec.whatwg.org/#readable-byte-stream-controller-enqueue
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-10-02 10:14:57 +00:00
Daeyeon Jeong
e213deabe5
stream: handle a pending pull request from a released reader
...
In order to meet the specification, this includes mainly the followings:
- Adding the 'release steps' to ReadableStreamController
- Responding to a pull request from a released reader in
ReadableByteStreamController
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44702
Refs: https://streams.spec.whatwg.org/#abstract-opdef-readablebytestreamcontroller-releasesteps
Refs: https://streams.spec.whatwg.org/#readable-byte-stream-controller-respond-in-readable-state
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-09-23 12:01:52 +00:00
Daeyeon Jeong
a4b2641c56
stream: remove abortReason from WritableStreamDefaultController
...
The `abortReason` has been removed from the spec since we can get
the abort reason via `controller.signal.reason`.
This reflects the change.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44540
Refs: https://streams.spec.whatwg.org/#ws-default-controller-class-definition
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2022-09-09 07:10:12 +00:00
Daeyeon Jeong
e06384cb48
stream: add ReadableByteStream.tee()
...
This supports teeing readable byte streams to meet
the latest web streams standards.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44505
Refs: https://streams.spec.whatwg.org/#readable-stream-tee
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-09-08 22:06:06 +00:00
Daeyeon Jeong
4af0a264da
stream: fix writableStream.abort()
...
This includes:
- Fixing `writableStream.abort(reason)`. Passing the reason was missing.
- Leaving a TODO to remove the internal abortReason property of
WritableStreamDefaultController.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44327
Refs: https://streams.spec.whatwg.org/#writable-stream-abort
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-09-05 15:07:11 +00:00
Daeyeon Jeong
aa90e7a9f4
stream: fix setting abort reason in ReadableStream.pipeTo()
...
In 14.2 in the specification, `error` should be signal’s abort reason.
The current behavior seems to assume that only an `AbortError` instance
is given as signal’s abort reason.
Refs: https://streams.spec.whatwg.org/#readable-stream-pipe-to
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44418
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-09-03 14:24:29 +00:00
Daeyeon Jeong
cc75a3c11e
stream: fix ReadableStreamReader.releaseLock()
...
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44292
Refs: https://streams.spec.whatwg.org/#default-reader-release-lock
Refs: https://streams.spec.whatwg.org/#byob-reader-release-lock
Refs: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/releaseLock
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-08-27 11:27:10 +00:00
Antoine du Hamel
ce639629dd
lib: use safe Promise alternatives when available
...
PR-URL: https://github.com/nodejs/node/pull/43476
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2022-08-27 11:37:01 +02:00
Daeyeon Jeong
937520a764
stream: fix isDetachedBuffer validations
...
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44114
Refs: https://github.com/nodejs/node/pull/43866
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-08-18 08:24:34 +00:00
Daeyeon Jeong
46f6d225af
stream: improve views validation on BYOBRequest
...
- This throws if the view is zero-length when there is an active reader
when using `ReadableStreamBYOBRequest.respondWithNewView()`.
- By doing that, we can get all tests passed in
`readable-byte-streams/bad-buffers-and-views.any.js`.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/44155
Refs: https://streams.spec.whatwg.org/#readable-byte-stream-controller-respond-with-new-view
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2022-08-15 18:46:13 +00:00
Kohei Ueno
c8bea71bba
stream: update TextEncoderStream to align the latest spec
...
PR-URL: https://github.com/nodejs/node/pull/44101
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-08-04 22:41:28 +00:00
Antoine du Hamel
d7f193434a
lib: add Promise methods to avoid-prototype-pollution lint rule
...
PR-URL: https://github.com/nodejs/node/pull/43849
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2022-07-26 23:38:24 +01:00
Daeyeon Jeong
0c27ca4bc9
stream: improve respondWithNewView()
...
This fixes validating an ArrayBufferView given to
ReadableStreamBYOBRequest.respondWithNewView() to improve the web
streams compatibility.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: https://github.com/nodejs/node/pull/43866
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-07-24 17:56:48 +01:00
txxnano
99b109f7f3
stream: initial approach to include strategy options on Readable.toWeb()
...
PR-URL: https://github.com/nodejs/node/pull/43515
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-07-13 11:14:38 +01:00
Antoine du Hamel
bb30e2da7a
lib: use null-prototype objects for property descriptors
...
PR-URL: https://github.com/nodejs/node/pull/43473
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2022-06-27 16:29:10 +01:00
LiviaMedeiros
a0178a1169
stream: use kEmptyObject
...
PR-URL: https://github.com/nodejs/node/pull/43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-06-11 12:18:14 +02:00
Antoine du Hamel
06d8606960
lib: use null-prototype objects for property descriptors
...
Refs: https://github.com/nodejs/node/pull/42921
PR-URL: https://github.com/nodejs/node/pull/43270
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-06-03 09:23:58 +01:00
Xuguang Mei
54bc3c9afa
stream: use .chunk when calling adapters's writev
...
Fix: https://github.com/nodejs/node/issues/42157
PR-URL: https://github.com/nodejs/node/pull/42161
Fixes: https://github.com/nodejs/node/issues/42157
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-03-03 04:53:59 +00:00
Gang Chen
de77515a77
lib: clean after the cancel algorithm throw error
...
PR-URL: https://github.com/nodejs/node/pull/41366
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2022-02-26 13:19:42 +00:00
Sean Quinlan
26f9a91cc9
lib: allow respondWithNewView on byob auto allocated streams
...
Fixes: https://github.com/nodejs/node/issues/41886
PR-URL: https://github.com/nodejs/node/pull/41887
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-02-16 22:28:56 +00:00
Mestery
998e5acc69
lib: move kEnumerableProperty to internal/util
...
PR-URL: https://github.com/nodejs/node/pull/41877
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-02-11 17:30:47 +00:00
Rich Trott
73a75c2ee6
stream: remove empty block
...
PR-URL: https://github.com/nodejs/node/pull/41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-02-05 12:58:31 +00:00
voltrexmaster
c4a6f9ab94
stream: rename unknown primordial
...
The primordials does not expose a primordial called `DataViewCtor`,
leading up to a non-existent constructor.
Fixes: https://github.com/nodejs/node/issues/40612
PR-URL: https://github.com/nodejs/node/pull/40622
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-01-20 09:19:37 +00:00
Rich Trott
b161440cd3
stream: remove unused function argument
...
watchClosed() is only ever called with an anonymous function for the
action parameter. This anonymous funciton does not take any arguments.
Remove unused argument from invocation of action().
PR-URL: https://github.com/nodejs/node/pull/41403
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2022-01-07 16:49:16 +00:00
Robert Nagy
a698c49993
stream: add isReadable helper
...
PR-URL: https://github.com/nodejs/node/pull/41199
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-29 20:42:10 +01:00
Rafael Gonzaga
113133badb
stream: fix enqueue race condition on esm modules
...
stream: use nextTick on close
PR-URL: https://github.com/nodejs/node/pull/40901
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-21 10:24:15 +00:00
Rich Trott
29f714b152
lib,tools: remove empty lines between JSDoc tags
...
This is in preparation for enabling a recommended JSDoc lint rule.
PR-URL: https://github.com/nodejs/node/pull/41147
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-12-19 05:30:09 +00:00
Robert Nagy
752d75d8bc
stream: add isErrored helper
...
Refs: https://github.com/nodejs/undici/pull/1134
PR-URL: https://github.com/nodejs/node/pull/41121
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2021-12-16 14:28:31 +01:00
Rich Trott
88dd9724b0
lib: include return types in JSDoc
...
Add types to @returns JSDoc annotations where the type is missing.
PR-URL: https://github.com/nodejs/node/pull/41130
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-12-12 03:51:00 +00:00
James M Snell
af28b0d540
stream: use cause options in AbortError constructors
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41008
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-12-02 12:14:10 -08:00
James M Snell
bc2944ae27
stream: fix the ReadableStreamBYOBReader error message
...
PR-URL: https://github.com/nodejs/node/pull/40846
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2021-11-25 08:36:01 -08:00
Robert Nagy
4832d1c02c
stream: add isDisturbed helper
...
Adds a helper util used to determine whether a stream has been
disturbed (read or cancelled).
Refs: https://github.com/nodejs/node/issues/39627
PR-URL: https://github.com/nodejs/node/pull/39628
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-08-06 07:45:38 +02:00
Robert Nagy
3f0b62375b
stream: convert premature close to AbortError
...
AbortError is a more "web" align alternative to
ERR_STREAM_PREMATURE_CLOSE.
PR-URL: https://github.com/nodejs/node/pull/39524
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-07-28 10:12:04 +02:00
Rich Trott
44ee6c2623
stream: call done() in consistent fashion
...
All three `destroy()` functions defined in adapter.js contain a `done()`
function that takes no arguments. In one instance, however, an argument
is nonetheless passed. Remove it for consistency.
PR-URL: https://github.com/nodejs/node/pull/39475
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2021-07-22 23:50:13 +00:00
James M Snell
6ad3872d5e
stream: import internal/util/types instead
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39331
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-07-15 13:43:26 -07:00
James M Snell
6cd12be347
fs: add FileHandle.prototype.readableWebStream()
...
Adds an experimental `readableWebStream()` method to `FileHandle` that
returns a web `ReadableStream`
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39331
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-07-15 13:43:20 -07:00
James M Snell
09ad64d66d
stream: add CompressionStream and DecompressionStream
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39348
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-07-14 10:52:59 -07:00
James M Snell
25e2f177cb
stream: implement TextEncoderStream and TextDecoderStream
...
Experimental as part of the web streams implementation
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39347
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-07-14 09:12:43 -07:00
James M Snell
2cc13ad6a8
stream: fixup property definition to avoid prototype polution
...
Fixup the definitions of the properties to avoid the possibility
of prototype polution on the object definitions.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39371
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-07-13 10:50:02 -07:00
James M Snell
a99c230305
stream: implement streams to webstreams adapters
...
Experimental adapters for the webstreams API
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39134
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-07-13 10:03:16 -07:00
Tobias Nießen
528639c5fe
lib: rename TransferedReadableStream etc
...
PR-URL: https://github.com/nodejs/node/pull/39352
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-07-13 08:09:31 +02:00
James M Snell
fa0c6883a6
stream: implement WHATWG streams
...
Experimental implementation of the WHATWG streams standard.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39062
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-06-30 12:54:41 -07:00