GeezerVison is showing github.com — fs: remove redundant code in readableWebStream() · nodejs/node@69b7f91
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/fs.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -444,7 +444,7 @@ Reads data from the file and stores that in the given buffer. |
444 | 444 | If the file is not modified concurrently, the end-of-file is reached when the |
445 | 445 | number of bytes read is zero. |
446 | 446 |
|
447 | | -#### `filehandle.readableWebStream(options)` |
| 447 | +#### `filehandle.readableWebStream([options])` |
448 | 448 |
|
449 | 449 | <!-- YAML |
450 | 450 | added: v17.0.0 |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/fs/promises.js +8-15Lines changed: 8 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -276,17 +276,8 @@ class FileHandle extends EventEmitterMixin(JSTransferable) { |
276 | 276 | this[kHandle], |
277 | 277 | undefined, |
278 | 278 | { ondone: () => this[kUnref]() }); |
279 | | - |
280 | | - const { |
281 | | - readableStreamCancel, |
282 | | - } = require('internal/webstreams/readablestream'); |
283 | | - this[kRef](); |
284 | | - this.once('close', () => { |
285 | | - readableStreamCancel(readable); |
286 | | - }); |
287 | 279 | } else { |
288 | 280 | const { |
289 | | - readableStreamCancel, |
290 | 281 | ReadableStream, |
291 | 282 | } = require('internal/webstreams/readablestream'); |
292 | 283 |
|
@@ -313,14 +304,16 @@ class FileHandle extends EventEmitterMixin(JSTransferable) { |
313 | 304 | ondone(); |
314 | 305 | }, |
315 | 306 | }); |
316 | | - |
317 | | - this[kRef](); |
318 | | - |
319 | | - this.once('close', () => { |
320 | | - readableStreamCancel(readable); |
321 | | - }); |
322 | 307 | } |
323 | 308 |
|
| 309 | + const { |
| 310 | + readableStreamCancel, |
| 311 | + } = require('internal/webstreams/readablestream'); |
| 312 | + this[kRef](); |
| 313 | + this.once('close', () => { |
| 314 | + readableStreamCancel(readable); |
| 315 | + }); |
| 316 | + |
324 | 317 | return readable; |
325 | 318 | } |
326 | 319 |
|
|