| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3ec78d1 commit fa9b5c3
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3017,6 +3017,34 @@ should have the same effect. The receiving end should also check the | |||
| 3017 | 3017 | [`readable.readableEnded`][] value on [`http.IncomingMessage`][] to get whether | |
| 3018 | 3018 | it was an aborted or graceful destroy. | |
| 3019 | 3019 | ||
| 3020 | + ### DEP0157: Thenable support in streams | ||
| 3021 | + | ||
| 3022 | + <!-- YAML | ||
| 3023 | + changes: | ||
| 3024 | + - version: REPLACEME | ||
| 3025 | + pr-url: https://github.com/nodejs/node/pull/40860 | ||
| 3026 | + description: Documentation-only deprecation. | ||
| 3027 | + --> | ||
| 3028 | + | ||
| 3029 | + Type: Documentation-only | ||
| 3030 | + | ||
| 3031 | + An undocumented feature of Node.js streams was to support thenables in | ||
| 3032 | + implementation methods. This is now deprecated, use callbacks instead and avoid | ||
| 3033 | + use of async function for streams implementation methods. | ||
| 3034 | + | ||
| 3035 | + This feature caused users to encounter unexpected problems where the user | ||
| 3036 | + implements the function in callback style but uses e.g. an async method which | ||
| 3037 | + would cause an error since mixing promise and callback semantics is not valid. | ||
| 3038 | + | ||
| 3039 | + ```js | ||
| 3040 | + const w = new Writable({ | ||
| 3041 | + async final(callback) { | ||
| 3042 | + await someOp(); | ||
| 3043 | + callback(); | ||
| 3044 | + } | ||
| 3045 | + }); | ||
| 3046 | + ``` | ||
| 3047 | + | ||
| 3020 | 3048 | [Legacy URL API]: url.md#legacy-url-api | |
| 3021 | 3049 | [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf | |
| 3022 | 3050 | [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments