Skip to content

Commit

Permalink
doc: remove util.promisify() content in readline.md
Browse files Browse the repository at this point in the history
PR-URL: #42552
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
Trott authored and juanarbol committed Apr 4, 2022
1 parent 3ee5434 commit 8e55e59
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,25 +355,6 @@ signal.addEventListener('abort', () => {
setTimeout(() => ac.abort(), 10000);
```

If this method is invoked as it's util.promisify()ed version, it returns a
Promise that fulfills with the answer. If the question is canceled using
an `AbortController` it will reject with an `AbortError`.

```js
const util = require('util');
const question = util.promisify(rl.question).bind(rl);

async function questionExample() {
try {
const answer = await question('What is you favorite food? ');
console.log(`Oh, so your favorite food is ${answer}`);
} catch (err) {
console.error('Question rejected', err);
}
}
questionExample();
```

### `rl.resume()`

<!-- YAML
Expand Down Expand Up @@ -899,25 +880,6 @@ signal.addEventListener('abort', () => {
setTimeout(() => ac.abort(), 10000);
```

If this method is invoked as it's util.promisify()ed version, it returns a
Promise that fulfills with the answer. If the question is canceled using
an `AbortController` it will reject with an `AbortError`.

```js
const util = require('util');
const question = util.promisify(rl.question).bind(rl);

async function questionExample() {
try {
const answer = await question('What is you favorite food? ');
console.log(`Oh, so your favorite food is ${answer}`);
} catch (err) {
console.error('Question rejected', err);
}
}
questionExample();
```

### `readline.clearLine(stream, dir[, callback])`

<!-- YAML
Expand Down

0 comments on commit 8e55e59

Please sign in to comment.