Skip to content

Commit 5370c14

Browse files
committed
address @vsemozhetbyt's comments
1 parent 351d9df commit 5370c14

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/api/fs.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,7 +2553,7 @@ fs.readFile('<directory>', (err, data) => {
25532553
automatically.
25542554
3. The reading will begin at the current position. If the file size is
25552555
10 bytes and if six bytes are already read with this file descriptor, then
2556-
`readFile` will return only the rest of the four bytes.
2556+
`readFile()` will return only the rest of the four bytes.
25572557

25582558
The `fs.readFile()` function buffers the entire file. To minimize memory costs,
25592559
when possible prefer streaming via `fs.createReadStream()`.
@@ -3547,12 +3547,12 @@ fs.writeFile('message.txt', 'Hello Node.js', 'utf8', callback);
35473547
1. Any specified file descriptor has to support writing.
35483548
2. If a file descriptor is specified as the `file`, it will not be closed
35493549
automatically.
3550-
3. The writing will begin at the beginning of the file. If the file size
3551-
is 10 bytes and if six bytes are written with this file descriptor, then
3552-
`writeFile` will return six bytes newly written and four bytes from the file.
3553-
For example, if the file already had `'Hello World'` and the newly written
3554-
content is `'Aloha'`, then the contents of the file would be `'Aloha World'`,
3555-
rather than just `'Aloha'`.
3550+
3. The writing will begin at the beginning of the file. If the file size is 10
3551+
bytes and if six bytes are written with this file descriptor, then the file
3552+
contents would be six newly written bytes and four bytes which were already
3553+
there in the file from position seven to ten. For example, if the file already
3554+
had `'Hello World'` and the newly written content is `'Aloha'`, then the
3555+
contents of the file would be `'Aloha World'`, rather than just `'Aloha'`.
35563556

35573557
It is unsafe to use `fs.writeFile()` multiple times on the same file without
35583558
waiting for the callback. For this scenario, [`fs.createWriteStream()`][] is

0 commit comments

Comments
 (0)