@@ -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' );
@@ -1568,7 +1558,7 @@ deprecated: v1.0.0
15681558 * ` exists ` {boolean}
15691559
15701560Test whether or not the given path exists by checking with the file system.
1571- Then call the ` callback ` argument with either true or false. Example :
1561+ Then call the ` callback ` argument with either true or false:
15721562
15731563``` js
15741564fs .exists (' /etc/passwd' , (exists ) => {
@@ -1901,7 +1891,7 @@ fs.ftruncate(fd, 4, (err) => {
19011891```
19021892
19031893If the file previously was shorter than ` len ` bytes, it is extended, and the
1904- extended part is filled with null bytes (` '\0' ` ). For example,
1894+ extended part is filled with null bytes (` '\0' ` ):
19051895
19061896``` js
19071897console .log (fs .readFileSync (' temp.txt' , ' utf8' ));
@@ -2505,7 +2495,7 @@ changes:
25052495 * ` err ` {Error}
25062496 * ` data ` {string|Buffer}
25072497
2508- Asynchronously reads the entire contents of a file. Example:
2498+ Asynchronously reads the entire contents of a file.
25092499
25102500``` js
25112501fs .readFile (' /etc/passwd' , (err , data ) => {
@@ -2519,7 +2509,7 @@ contents of the file.
25192509
25202510If no encoding is specified, then the raw buffer is returned.
25212511
2522- If ` options ` is a string, then it specifies the encoding. Example :
2512+ If ` options ` is a string, then it specifies the encoding:
25232513
25242514``` js
25252515fs .readFile (' /etc/passwd' , ' utf8' , callback);
@@ -3519,8 +3509,6 @@ Asynchronously writes data to a file, replacing the file if it already exists.
35193509
35203510The ` encoding ` option is ignored if ` data ` is a buffer.
35213511
3522- Example:
3523-
35243512``` js
35253513const data = new Uint8Array (Buffer .from (' Hello Node.js' ));
35263514fs .writeFile (' message.txt' , data, (err ) => {
@@ -3529,7 +3517,7 @@ fs.writeFile('message.txt', data, (err) => {
35293517});
35303518```
35313519
3532- If ` options ` is a string, then it specifies the encoding. Example :
3520+ If ` options ` is a string, then it specifies the encoding:
35333521
35343522``` js
35353523fs .writeFile (' message.txt' , ' Hello Node.js' , ' utf8' , callback);
@@ -3840,7 +3828,7 @@ doTruncate().catch(console.error);
38403828```
38413829
38423830If the file previously was shorter than ` len ` bytes, it is extended, and the
3843- extended part is filled with null bytes (` '\0' ` ). For example,
3831+ extended part is filled with null bytes (` '\0' ` ):
38443832
38453833``` js
38463834const fs = require (' fs' );
@@ -4050,8 +4038,6 @@ fallback copy mechanism is used.
40504038create a copy-on-write reflink. If the platform does not support copy-on-write,
40514039then the operation will fail.
40524040
4053- Example:
4054-
40554041``` js
40564042const fsPromises = require (' fs' ).promises ;
40574043
@@ -4061,8 +4047,7 @@ fsPromises.copyFile('source.txt', 'destination.txt')
40614047 .catch (() => console .log (' The file could not be copied' ));
40624048```
40634049
4064- If the third argument is a number, then it specifies ` flags ` , as shown in the
4065- following example.
4050+ If the third argument is a number, then it specifies ` flags ` :
40664051
40674052``` js
40684053const fs = require (' fs' );
0 commit comments