Files
node/lib/internal
Ian Kerins 14b2d496a0 fs: make FileHandle.readableWebStream always create byte streams
The original implementation of the experimental
`FileHandle.readableWebStream` API created non-`type: 'bytes'` streams,
which prevented callers from creating `mode: 'byob'` readers from the
returned stream, which means they could not achieve the associated
"zero-copy" performance characteristics.

Then, #46933 added a parameter allowing callers to pass the `type`
parameter down to the ReadableStream constructor, exposing the same
semantics to callers of `FileHandle.readableWebStream`.

But there is no point to giving callers this choice: FileHandle-derived
streams are by their very nature byte streams. We should not require
callers to explicitly opt in to having byte stream semantics. Moreover,
I do not see a situation in which callers would ever want to have a
non-bytes stream: bytes-streams only do anything differently than normal
ones if `mode: 'byob'` is passed to `getReader`.

So, remove the `options` parameter and always create a ReadableStream
with `type: 'bytes'`.

Fixes #54041.

PR-URL: https://github.com/nodejs/node/pull/55461
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-04-16 03:29:18 -03:00
..
2024-11-27 11:03:39 -05:00
2024-10-04 10:20:24 +02:00
2024-10-04 10:20:26 +02:00
2025-02-06 01:15:06 +01:00
2024-11-27 11:03:39 -05:00
2024-09-12 11:06:49 +02:00
2024-04-29 22:46:31 +02:00
2024-11-27 11:03:39 -05:00
2024-11-27 11:03:39 -05:00
2025-04-16 03:29:16 -03:00
2024-10-04 10:20:24 +02:00
2025-01-05 12:57:35 -05:00
2024-10-04 10:20:24 +02:00
2024-08-30 15:52:14 -03:00
2024-02-19 01:19:44 +00:00

Internal Modules

The modules located in lib/internal directory are exclusively meant for internal usage within the Node.js core. They are not intended to be accessed via user modules require(). These modules may change at any point in time. Relying on these internal modules outside the core is not supported and can lead to unpredictable behavior.

In certain scenarios, accessing these internal modules for debugging or experimental purposes might be necessary. Node.js provides the --expose-internals flag to expose these modules to userland code. This flag only exists to assist Node.js maintainers with debugging internals. It is not meant for use outside the project.