Commit ccaf7fe
fs: make
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: #55461
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>FileHandle.readableWebStream always create byte streams1 parent 0c3ae25 commit ccaf7feCopy full SHA for ccaf7fe
File tree
Expand file treeCollapse file tree
3 files changed
+47
-95
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal/fs
- test/parallel
Expand file treeCollapse file tree
3 files changed
+47
-95
lines changedOpen diff view settings
Collapse file
+6-6Lines changed: 6 additions & 6 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
477 | 477 | |
478 | 478 | |
479 | 479 | |
480 | | - |
| 480 | + |
481 | 481 | |
482 | 482 | |
483 | 483 | |
484 | 484 | |
| 485 | + |
| 486 | + |
| 487 | + |
485 | 488 | |
486 | 489 | |
487 | 490 | |
| ||
491 | 494 | |
492 | 495 | |
493 | 496 | |
494 | | - |
495 | | - |
496 | | - |
497 | | - |
498 | 497 | |
499 | 498 | |
500 | | - |
| 499 | + |
| 500 | + |
501 | 501 | |
502 | 502 | |
503 | 503 | |
|
Collapse file
lib/internal/fs/promises.js
Copy file name to clipboardExpand all lines: lib/internal/fs/promises.js+31-36Lines changed: 31 additions & 36 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
142 | 142 | |
143 | 143 | |
144 | 144 | |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
145 | 149 | |
146 | 150 | |
147 | 151 | |
| ||
276 | 280 | |
277 | 281 | |
278 | 282 | |
279 | | - |
280 | | - |
281 | | - |
282 | 283 | |
283 | 284 | |
284 | | - |
| 285 | + |
285 | 286 | |
286 | 287 | |
287 | 288 | |
| ||
293 | 294 | |
294 | 295 | |
295 | 296 | |
| 297 | + |
| 298 | + |
| 299 | + |
| 300 | + |
| 301 | + |
| 302 | + |
| 303 | + |
296 | 304 | |
297 | | - |
298 | 305 | |
299 | | - |
300 | | - |
301 | | - |
302 | | - |
303 | | - |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | | - |
309 | | - |
310 | | - |
| 306 | + |
| 307 | + |
311 | 308 | |
312 | | - |
313 | | - |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
314 | 313 | |
315 | | - |
316 | | - |
317 | | - |
| 314 | + |
| 315 | + |
| 316 | + |
318 | 317 | |
319 | | - |
320 | | - |
321 | | - |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
322 | 322 | |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
| 323 | + |
| 324 | + |
327 | 325 | |
328 | | - |
329 | | - |
| 326 | + |
| 327 | + |
| 328 | + |
| 329 | + |
330 | 330 | |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | 331 | |
337 | 332 | |
338 | 333 | |
|
Collapse file
test/parallel/test-filehandle-readablestream.js
Copy file name to clipboardExpand all lines: test/parallel/test-filehandle-readablestream.js+10-53Lines changed: 10 additions & 53 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
87 | 87 | |
88 | 88 | |
89 | 89 | |
90 | | - |
| 90 | + |
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | | - |
| 94 | + |
95 | 95 | |
96 | 96 | |
97 | 97 | |
| ||
114 | 114 | |
115 | 115 | |
116 | 116 | |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | | - |
150 | | - |
151 | | - |
152 | | - |
153 | | - |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | | - |
159 | | - |
160 | | - |
| 117 | + |
161 | 118 | |
162 | 119 | |
163 | | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | | - |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
169 | 125 | |
170 | | - |
| 126 | + |
| 127 | + |
171 | 128 | |
172 | 129 | |
0 commit comments