Skip to content

Commit

Permalink
fixup! fs: add FileHandle.prototype.readLines
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Apr 3, 2022
1 parent 2098780 commit 7ec3eda
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions doc/api/fs.md
Expand Up @@ -499,31 +499,31 @@ Convenient alias to create a `readline` interface and stream over the file. See
```mjs
import { open } from 'node:fs/promises';

let fh;
let file;
try {
fh = await open(new URL(import.meta.url));
file = await open('./some/file/to/read');

for await (const line of fh.readLines()) {
for await (const line of file.readLines()) {
console.log(line);
}
} finally {
await fh?.close();
await file?.close();
}
```
```cjs
const { open } = require('node:fs/promises');

(async () => {
let fh;
let file;
try {
fh = await open(__filename);
file = await open('./some/file/to/read');

for await (const line of fh.readLines()) {
for await (const line of file.readLines()) {
console.log(line);
}
} finally {
await fh?.close();
await file?.close();
}
})();
```
Expand Down

0 comments on commit 7ec3eda

Please sign in to comment.