Skip to content

Commit e6c1949

Browse files
committed
doc: add Buffer import to examples to satisfy lint
PR-URL: #63634 Signed-off-by: matteo <matteo@example.com>
1 parent ce65c0b commit e6c1949

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

doc/api/fs.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ of the file.
730730
An example using the `buffer` option with a pre-allocated buffer:
731731
732732
```mjs
733+
import { Buffer } from 'node:buffer';
733734
import { open } from 'node:fs/promises';
734735

735736
const file = await open('./some/file/to/read');
@@ -745,6 +746,7 @@ try {
745746
An example using the `buffer` option with a function returning a buffer:
746747
747748
```mjs
749+
import { Buffer } from 'node:buffer';
748750
import { open } from 'node:fs/promises';
749751

750752
const file = await open('./some/file/to/read');
@@ -1902,6 +1904,7 @@ Any specified {FileHandle} has to support reading.
19021904
An example using the `buffer` option with a pre-allocated buffer:
19031905
19041906
```mjs
1907+
import { Buffer } from 'node:buffer';
19051908
import { readFile } from 'node:fs/promises';
19061909
19071910
const buf = Buffer.alloc(16384);
@@ -1912,6 +1915,7 @@ console.log(contents); // A view over `buf` containing only the bytes read
19121915
An example using the `buffer` option with a function returning a buffer:
19131916
19141917
```mjs
1918+
import { Buffer } from 'node:buffer';
19151919
import { readFile } from 'node:fs/promises';
19161920
19171921
const contents = await readFile('/path/to/file', {
@@ -4420,6 +4424,7 @@ system requests but rather the internal buffering `fs.readFile` performs.
44204424
An example using the `buffer` option with a pre-allocated buffer:
44214425
44224426
```mjs
4427+
import { Buffer } from 'node:buffer';
44234428
import { readFile } from 'node:fs';
44244429

44254430
const buf = Buffer.alloc(16384);
@@ -4432,6 +4437,7 @@ readFile('/path/to/file', { buffer: buf }, (err, data) => {
44324437
An example using the `buffer` option with a function returning a buffer:
44334438
44344439
```mjs
4440+
import { Buffer } from 'node:buffer';
44354441
import { readFile } from 'node:fs';
44364442

44374443
readFile('/path/to/file', {

0 commit comments

Comments
 (0)