@@ -479,8 +479,8 @@ fs.appendFile('message.txt', 'data to append', 'utf8', callback);
479479
480480Any specified file descriptor has to have been opened for appending.
481481
482- _ Note : If a file descriptor is specified as the ` file ` , it will not be closed
483- automatically._
482+ * Note * : If a file descriptor is specified as the ` file ` , it will not be closed
483+ automatically.
484484
485485## fs.appendFileSync(file, data[ , options] )
486486<!-- YAML
@@ -1248,10 +1248,10 @@ On Linux, positional writes don't work when the file is opened in append mode.
12481248The kernel ignores the position argument and always appends the data to
12491249the end of the file.
12501250
1251- _ Note : The behavior of ` fs.open() ` is platform specific for some flags. As such,
1251+ * Note * : The behavior of ` fs.open() ` is platform- specific for some flags. As such,
12521252opening a directory on macOS and Linux with the ` 'a+' ` flag - see example
12531253below - will return an error. In contrast, on Windows and FreeBSD, a file
1254- descriptor will be returned._
1254+ descriptor will be returned.
12551255
12561256``` js
12571257// macOS and Linux
@@ -1368,11 +1368,27 @@ If `options` is a string, then it specifies the encoding. Example:
13681368``` js
13691369fs .readFile (' /etc/passwd' , ' utf8' , callback);
13701370```
1371+ * Note* : When the path is a directory, the behavior of
1372+ ` fs.readFile() ` and [ ` fs.readFileSync() ` ] [ ] is platform-specific. On macOS,
1373+ Linux, and Windows, an error will be returned. On FreeBSD, a representation
1374+ of the directory's contents will be returned.
1375+
1376+ ``` js
1377+ // macOS, Linux and Windows
1378+ fs .readFile (' <directory>' , (err , data ) => {
1379+ // => [Error: EISDIR: illegal operation on a directory, read <directory>]
1380+ });
1381+
1382+ // FreeBSD
1383+ fs .readFile (' <directory>' , (err , data ) => {
1384+ // => null, <data>
1385+ });
1386+ ```
13711387
13721388Any specified file descriptor has to support reading.
13731389
1374- _ Note : If a file descriptor is specified as the ` file ` , it will not be closed
1375- automatically._
1390+ * Note * : If a file descriptor is specified as the ` path ` , it will not be closed
1391+ automatically.
13761392
13771393## fs.readFileSync(file[ , options] )
13781394<!-- YAML
@@ -1389,6 +1405,18 @@ Synchronous version of [`fs.readFile`][]. Returns the contents of the `file`.
13891405If the ` encoding ` option is specified then this function returns a
13901406string. Otherwise it returns a buffer.
13911407
1408+ * Note* : Similar to [ ` fs.readFile() ` ] [ ] , when the path is a directory, the
1409+ behavior of ` fs.readFileSync() ` is platform-specific.
1410+
1411+ ``` js
1412+ // macOS, Linux and Windows
1413+ fs .readFileSync (' <directory>' );
1414+ // => [Error: EISDIR: illegal operation on a directory, read <directory>]
1415+
1416+ // FreeBSD
1417+ fs .readFileSync (' <directory>' ); // => null, <data>
1418+ ```
1419+
13921420## fs.readlink(path[ , options] , callback)
13931421<!-- YAML
13941422added: v0.1.31
@@ -1641,9 +1669,9 @@ have effectively stopped watching `filename`.
16411669Calling ` fs.unwatchFile() ` with a filename that is not being watched is a
16421670no-op, not an error.
16431671
1644- _ Note : [ ` fs.watch() ` ] [ ] is more efficient than ` fs.watchFile() ` and ` fs.unwatchFile() ` .
1672+ * Note * : [ ` fs.watch() ` ] [ ] is more efficient than ` fs.watchFile() ` and ` fs.unwatchFile() ` .
16451673` fs.watch() ` should be used instead of ` fs.watchFile() ` and ` fs.unwatchFile() `
1646- when possible._
1674+ when possible.
16471675
16481676## fs.utimes(path, atime, mtime, callback)
16491677<!-- YAML
@@ -1817,15 +1845,15 @@ These stat objects are instances of `fs.Stat`.
18171845If you want to be notified when the file was modified, not just accessed,
18181846you need to compare ` curr.mtime ` and ` prev.mtime ` .
18191847
1820- _ Note : when an ` fs.watchFile ` operation results in an ` ENOENT ` error, it will
1848+ * Note * : when an ` fs.watchFile ` operation results in an ` ENOENT ` error, it will
18211849 invoke the listener once, with all the fields zeroed (or, for dates, the Unix
18221850 Epoch). In Windows, ` blksize ` and ` blocks ` fields will be ` undefined ` , instead
18231851 of zero. If the file is created later on, the listener will be called again,
1824- with the latest stat objects. This is a change in functionality since v0.10._
1852+ with the latest stat objects. This is a change in functionality since v0.10.
18251853
1826- _ Note : [ ` fs.watch() ` ] [ ] is more efficient than ` fs.watchFile ` and
1854+ * Note * : [ ` fs.watch() ` ] [ ] is more efficient than ` fs.watchFile ` and
18271855` fs.unwatchFile ` . ` fs.watch ` should be used instead of ` fs.watchFile ` and
1828- ` fs.unwatchFile ` when possible._
1856+ ` fs.unwatchFile ` when possible.
18291857
18301858## fs.write(fd, buffer, offset, length[ , position] , callback)
18311859<!-- YAML
@@ -1935,8 +1963,8 @@ Note that it is unsafe to use `fs.writeFile` multiple times on the same file
19351963without waiting for the callback. For this scenario,
19361964` fs.createWriteStream ` is strongly recommended.
19371965
1938- _ Note : If a file descriptor is specified as the ` file ` , it will not be closed
1939- automatically._
1966+ * Note * : If a file descriptor is specified as the ` file ` , it will not be closed
1967+ automatically.
19401968
19411969## fs.writeFileSync(file, data[ , options] )
19421970<!-- YAML
0 commit comments