diff --git a/CHANGELOG.md b/CHANGELOG.md index d8fb751ff561..ec7305dada2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,8 @@ release. -15.8.0
+15.9.0
+15.8.0
15.7.0
15.6.0
15.5.1
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 5f1d578beeb3..9e30f3481aa1 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -129,6 +129,10 @@ class MyAddedCallbacks extends MyAsyncCallbacks { const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); ``` +Because promises are asynchronous resources whose lifecycle is tracked +via the async hooks mechanism, the `init()`, `before()`, `after()`, and +`destroy()` callbacks *must not* be async functions that return promises. + ##### Error handling If any `AsyncHook` callbacks throw, the application will print the stack trace diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 161251a9301c..48c0094f9ecf 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1381,7 +1381,7 @@ keys. @@ -1844,7 +1844,7 @@ The issuer identification included in this certificate. ### `x509.issuerCertificate` * Type: {X509Certificate} diff --git a/doc/api/fs.md b/doc/api/fs.md index 5e7521ce7c8e..2d179c89396c 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1191,7 +1191,7 @@ The `atime` and `mtime` arguments follow these rules: ### `fsPromises.watch(filename[, options])` * `filename` {string|Buffer|URL} @@ -1699,7 +1699,7 @@ See the POSIX chown(2) documentation for more detail. > Stability: 1 - Experimental diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index ccdd9e9d2f68..e7dc8c38ac27 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -655,7 +655,7 @@ performance.mark('meow'); ## `perf_hooks.createHistogram([options])` * `options` {Object} @@ -814,19 +814,19 @@ implement the `enable()` and `disable()` methods. ## Class: `RecordableHistogram extends Histogram` ### `histogram.record(val)` * `val` {number|bigint} The amount to record in the histogram. ### `histogram.recordDelta()` Calculates the amount of time (in nanoseconds) that has passed since the diff --git a/doc/api/stream.md b/doc/api/stream.md index cb4085806bb6..363e80313a4a 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1719,7 +1719,11 @@ pipeline( ); ``` -The `pipeline` API provides promise version: +The `pipeline` API provides a promise version, which can also +receive an options argument as the last parameter with a +`signal` {AbortSignal} property. When the signal is aborted, +`destroy` will be called on the underlying pipeline, with an +`AbortError`. ```js const { pipeline } = require('stream/promises'); @@ -1736,6 +1740,30 @@ async function run() { run().catch(console.error); ``` +To use an `AbortSignal`, pass it inside an options object, +as the last argument: + +```js +const { pipeline } = require('stream/promises'); + +async function run() { + const ac = new AbortController(); + const options = { + signal: ac.signal, + }; + + setTimeout(() => ac.abort(), 1); + await pipeline( + fs.createReadStream('archive.tar'), + zlib.createGzip(), + fs.createWriteStream('archive.tar.gz'), + options, + ); +} + +run().catch(console.error); // AbortError +``` + The `pipeline` API also supports async generators: ```js diff --git a/doc/api/timers.md b/doc/api/timers.md index a6a9f81f5076..55a948ecb586 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -365,7 +365,7 @@ added: v15.0.0 ### `timersPromises.setInterval([delay[, value[, options]]])` Returns an async iterator that generates values in an interval of `delay` ms. diff --git a/doc/api/tls.md b/doc/api/tls.md index 376c9318fccf..6817451d1032 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -1150,7 +1150,7 @@ to implement the `tls-unique` channel binding from [RFC 5929][]. ### `tlsSocket.getPeerX509Certificate()` * Returns: {X509Certificate} @@ -1227,7 +1227,7 @@ See [Session Resumption][] for more information. ### `tlsSocket.getX509Certificate()` * Returns: {X509Certificate} diff --git a/doc/api/vm.md b/doc/api/vm.md index cb97cda7d791..824fb598da1b 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -813,7 +813,7 @@ const vm = require('vm'); @@ -697,7 +697,7 @@ The {CryptoKey} (secret key) generating algorithms supported include: diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 8661ba117566..f113bb2d9678 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -474,7 +474,7 @@ are part of the channel.