node/lib
James M Snell b9586bf898
fs: add autoClose option to FileHandle readableWebStream
By default, the `readableWebStream` method of `FileHandle` returns
a ReadableStream that, when finished, does not close the underlying
FileHandle. This can lead to issues if the stream is consumed
without having a reference to the FileHandle to close after use.
This commit adds an `autoClose` option to the `readableWebStream`
method, which, when set to `true`, will automatically close the
FileHandle when the stream is finished or canceled.

The test modified in this commit demonstrates one of the cases where
this is necessary in that the stream is consumed by separate code than
the FileHandle which was being left to close the underlying fd when
it is garbage collected, which is a deprecated behavior.

PR-URL: https://github.com/nodejs/node/pull/58548
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2025-06-10 18:20:32 +02:00
..
assert
dns
fs
inspector
internal fs: add autoClose option to FileHandle readableWebStream 2025-06-10 18:20:32 +02:00
path
readline readline: fix unresolved promise on abortion 2025-04-02 15:15:48 +02:00
stream
test test_runner: do not expose internal loader 2024-08-14 08:37:04 +02:00
timers lib: remove unnecessary optional chaining 2024-11-27 11:03:33 -05:00
util
_http_agent.js lib: remove startsWith/endsWith primordials for char checks 2024-11-27 11:03:39 -05:00
_http_client.js http: add setDefaultHeaders option to http.request 2025-01-05 13:05:28 -05:00
_http_common.js lib: prefer optional chaining 2024-10-04 10:20:24 +02:00
_http_incoming.js lib: prefer optional chaining 2024-10-04 10:20:24 +02:00
_http_outgoing.js http,https: give names to anonymous or misnamed functions 2025-06-10 14:52:13 +02:00
_http_server.js lib: make ERM functions into wrappers returning undefined 2025-06-10 17:22:59 +02:00
_stream_duplex.js
_stream_passthrough.js
_stream_readable.js
_stream_transform.js
_stream_wrap.js
_stream_writable.js
_tls_common.js lib: prefer logical assignment 2024-11-27 11:03:39 -05:00
_tls_wrap.js tls: remove unnecessary type check on normalize 2025-04-17 10:51:40 -03:00
assert.js assert: mark partialDeepStrictEqual() as stable 2025-06-10 16:38:57 +02:00
async_hooks.js inspector: skip promise hook in the inspector async hook 2025-04-17 10:51:06 -03:00
buffer.js util: harden more built-in classes against prototype pollution 2025-01-05 13:05:32 -05:00
child_process.js child_process: give names to promisified `exec()` and `execFile()` 2025-06-10 11:34:07 +02:00
cluster.js cluster: use ObjectPrototypeHasOwnProperty 2023-05-25 16:04:19 +00:00
console.js
constants.js
crypto.js tools: add lint rule to keep primordials in ASCII order 2024-04-29 22:46:28 +02:00
dgram.js lib: make ERM functions into wrappers returning undefined 2025-06-10 17:22:59 +02:00
diagnostics_channel.js diagnostics_channel: fix unsubscribe during publish 2024-11-27 01:23:18 -05:00
dns.js dns: remove redundant code using common variable 2025-04-17 10:51:33 -03:00
domain.js lib: the REPL should survive deletion of Array.prototype methods 2024-10-04 10:20:04 +02:00
eslint.config_partial.mjs lib: remove no-mixed-operators eslint rule 2025-06-10 14:52:18 +02:00
events.js doc: update return types for eventNames method in EventEmitter 2025-06-10 11:34:07 +02:00
fs.js fs: glob is stable, so should not emit experimental warnings 2025-05-21 17:01:17 +02:00
http.js http: expose websockets 2024-07-16 12:01:14 +02:00
http2.js http2: add server handshake utility 2024-01-12 16:09:48 +00:00
https.js lib: make ERM functions into wrappers returning undefined 2025-06-10 17:22:59 +02:00
inspector.js inspector: add protocol method Network.dataReceived 2025-06-10 14:52:18 +02:00
module.js lib: allow skipping source maps in node_modules 2025-02-06 01:10:44 +01:00
net.js lib: make ERM functions into wrappers returning undefined 2025-06-10 17:22:59 +02:00
os.js os: fix netmask format check condition in getCIDR function 2025-05-19 12:14:00 +02:00
path.js path: improve path.resolve() performance when used as process.cwd() 2025-06-10 17:03:16 +02:00
perf_hooks.js
process.js
punycode.js punycode: limit deprecation warning 2025-02-06 01:10:36 +01:00
querystring.js lib: prefer logical assignment 2024-11-27 11:03:39 -05:00
readline.js lib: prefer logical assignment 2024-11-27 11:03:39 -05:00
repl.js Revert "test: add tests for REPL custom evals" 2025-05-19 12:13:54 +02:00
sea.js sea: support sea.getRawAsset() 2024-02-02 15:25:34 +01:00
sqlite.js sqlite: add DatabaseSync.prototype[Symbol.dispose]() 2025-04-17 10:51:46 -03:00
stream.js stream: change stream to use index instead of `for...of` 2024-08-30 15:52:11 -03:00
string_decoder.js lib: move encodingsMap to internal/util 2024-02-27 13:27:18 +01:00
sys.js lib: add note about removing `node:sys` module 2024-09-12 11:06:42 +02:00
test.js test_runner: add assert.register() API 2025-02-03 20:09:53 +01:00
timers.js timers: optimize timer functions with improved argument handling 2025-04-17 10:51:54 -03:00
tls.js lib: limit split function calls to prevent excessive array length 2025-04-17 10:51:46 -03:00
trace_events.js trace_events: use private fields instead of symbols for `Tracing` 2023-12-28 23:20:22 +00:00
tty.js tty: initialize winSize array with values 2024-08-14 08:36:58 +02:00
url.js url: improve performance of the format function 2025-06-10 10:39:40 +02:00
util.js util: add 'none' style to styleText 2025-06-10 17:28:30 +02:00
v8.js v8: add v8.getCppHeapStatistics() method 2025-04-17 10:51:20 -03:00
vm.js lib: add validation for options in compileFunction 2025-01-05 12:57:36 -05:00
wasi.js
worker_threads.js src,worker: add isInternalWorker 2025-02-03 20:10:01 +01:00
zlib.js zlib: remove mentions of unexposed Z_TREES constant 2025-06-10 15:10:04 +02:00