doc: improve util.promisify() content in readline.md#42552
doc: improve util.promisify() content in readline.md#42552nodejs-github-bot merged 1 commit intonodejs:masterfrom
Conversation
aduh95
left a comment
There was a problem hiding this comment.
I don't think we want to recommend using util.promisify over the "built-in" promisified alternative.
doc/api/readline.md
Outdated
| Use [`util.promisify()`][] to create a version that returns a | ||
| promise that fulfills with the answer. If the question is canceled using | ||
| an `AbortController` it will reject with an `AbortError`. |
There was a problem hiding this comment.
| Use [`util.promisify()`][] to create a version that returns a | |
| promise that fulfills with the answer. If the question is canceled using | |
| an `AbortController` it will reject with an `AbortError`. | |
| Don't use [`util.promisify()`][] to create a version that returns a | |
| promise that fulfills with the answer, use `require('readline/promises').createInterface` instead. If the question is canceled using | |
| an `AbortController` it will reject with an `AbortError`. |
There was a problem hiding this comment.
We can also recommend AbortSignal.timeout()
There was a problem hiding this comment.
Since there's a documented promise API, I think we can just delete all the text, or replace it with something like "See [other API][] for a promise-based version of this API."
There was a problem hiding this comment.
Yes, removing it could make sense indeed. Worth noting that promise API is still marked as experimental and not available on Node.js <17, so we could expect a large chunk of our users would prefer to rely on util.promisify. Folks who want to support older release lines should check the documentation of the older release line.
|
Content removed entirely. Does that work well enough, @aduh95? |
|
Landed in 059b890 |
PR-URL: nodejs#42552 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: #42552 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#42552 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
No description provided.