@@ -1044,16 +1044,14 @@ changes:
10441044Asynchronously append data to a file, creating the file if it does not yet
10451045exist. ` data ` can be a string or a [ ` Buffer ` ] [ ] .
10461046
1047- Example:
1048-
10491047``` js
10501048fs .appendFile (' message.txt' , ' data to append' , (err ) => {
10511049 if (err) throw err;
10521050 console .log (' The "data to append" was appended to file!' );
10531051});
10541052```
10551053
1056- If ` options ` is a string, then it specifies the encoding. Example :
1054+ If ` options ` is a string, then it specifies the encoding:
10571055
10581056``` js
10591057fs .appendFile (' message.txt' , ' data to append' , ' utf8' , callback);
@@ -1097,8 +1095,6 @@ changes:
10971095Synchronously append data to a file, creating the file if it does not yet
10981096exist. ` data ` can be a string or a [ ` Buffer ` ] [ ] .
10991097
1100- Example:
1101-
11021098``` js
11031099try {
11041100 fs .appendFileSync (' message.txt' , ' data to append' );
@@ -1108,7 +1104,7 @@ try {
11081104}
11091105```
11101106
1111- If ` options ` is a string, then it specifies the encoding. Example :
1107+ If ` options ` is a string, then it specifies the encoding:
11121108
11131109``` js
11141110fs .appendFileSync (' message.txt' , ' data to append' , ' utf8' );
@@ -1344,8 +1340,6 @@ fallback copy mechanism is used.
13441340create a copy-on-write reflink. If the platform does not support copy-on-write,
13451341then the operation will fail.
13461342
1347- Example:
1348-
13491343``` js
13501344const fs = require (' fs' );
13511345
@@ -1356,8 +1350,7 @@ fs.copyFile('source.txt', 'destination.txt', (err) => {
13561350});
13571351```
13581352
1359- If the third argument is a number, then it specifies ` flags ` , as shown in the
1360- following example.
1353+ If the third argument is a number, then it specifies ` flags ` :
13611354
13621355``` js
13631356const fs = require (' fs' );
@@ -1395,8 +1388,6 @@ fallback copy mechanism is used.
13951388create a copy-on-write reflink. If the platform does not support copy-on-write,
13961389then the operation will fail.
13971390
1398- Example:
1399-
14001391``` js
14011392const fs = require (' fs' );
14021393
@@ -1405,8 +1396,7 @@ fs.copyFileSync('source.txt', 'destination.txt');
14051396console .log (' source.txt was copied to destination.txt' );
14061397```
14071398
1408- If the third argument is a number, then it specifies ` flags ` , as shown in the
1409- following example.
1399+ If the third argument is a number, then it specifies ` flags ` :
14101400
14111401``` js
14121402const fs = require (' fs' );
@@ -1563,7 +1553,7 @@ deprecated: v1.0.0
15631553 * ` exists ` {boolean}
15641554
15651555Test whether or not the given path exists by checking with the file system.
1566- Then call the ` callback ` argument with either true or false. Example :
1556+ Then call the ` callback ` argument with either true or false:
15671557
15681558``` js
15691559fs .exists (' /etc/passwd' , (exists ) => {
@@ -1896,7 +1886,7 @@ fs.ftruncate(fd, 4, (err) => {
18961886```
18971887
18981888If the file previously was shorter than ` len ` bytes, it is extended, and the
1899- extended part is filled with null bytes (` '\0' ` ). For example,
1889+ extended part is filled with null bytes (` '\0' ` ):
19001890
19011891``` js
19021892console .log (fs .readFileSync (' temp.txt' , ' utf8' ));
@@ -2500,7 +2490,7 @@ changes:
25002490 * ` err ` {Error}
25012491 * ` data ` {string|Buffer}
25022492
2503- Asynchronously reads the entire contents of a file. Example:
2493+ Asynchronously reads the entire contents of a file.
25042494
25052495``` js
25062496fs .readFile (' /etc/passwd' , (err , data ) => {
@@ -2514,7 +2504,7 @@ contents of the file.
25142504
25152505If no encoding is specified, then the raw buffer is returned.
25162506
2517- If ` options ` is a string, then it specifies the encoding. Example :
2507+ If ` options ` is a string, then it specifies the encoding:
25182508
25192509``` js
25202510fs .readFile (' /etc/passwd' , ' utf8' , callback);
@@ -3514,8 +3504,6 @@ Asynchronously writes data to a file, replacing the file if it already exists.
35143504
35153505The ` encoding ` option is ignored if ` data ` is a buffer.
35163506
3517- Example:
3518-
35193507``` js
35203508const data = new Uint8Array (Buffer .from (' Hello Node.js' ));
35213509fs .writeFile (' message.txt' , data, (err ) => {
@@ -3524,7 +3512,7 @@ fs.writeFile('message.txt', data, (err) => {
35243512});
35253513```
35263514
3527- If ` options ` is a string, then it specifies the encoding. Example :
3515+ If ` options ` is a string, then it specifies the encoding:
35283516
35293517``` js
35303518fs .writeFile (' message.txt' , ' Hello Node.js' , ' utf8' , callback);
@@ -3835,7 +3823,7 @@ doTruncate().catch(console.error);
38353823```
38363824
38373825If the file previously was shorter than ` len ` bytes, it is extended, and the
3838- extended part is filled with null bytes (` '\0' ` ). For example,
3826+ extended part is filled with null bytes (` '\0' ` ):
38393827
38403828``` js
38413829const fs = require (' fs' );
@@ -4045,8 +4033,6 @@ fallback copy mechanism is used.
40454033create a copy-on-write reflink. If the platform does not support copy-on-write,
40464034then the operation will fail.
40474035
4048- Example:
4049-
40504036``` js
40514037const fsPromises = require (' fs' ).promises ;
40524038
@@ -4056,8 +4042,7 @@ fsPromises.copyFile('source.txt', 'destination.txt')
40564042 .catch (() => console .log (' The file could not be copied' ));
40574043```
40584044
4059- If the third argument is a number, then it specifies ` flags ` , as shown in the
4060- following example.
4045+ If the third argument is a number, then it specifies ` flags ` :
40614046
40624047``` js
40634048const fs = require (' fs' );
0 commit comments