Skip to content

Commit 04eed23

Browse files
Trotttargos
authored andcommitted
doc: remove "note that" from fs doc
Remove "note that" from the fs documentation, along with other minor nearby improvements. Before: Note that some characters are obscured by Strong Bad's head. After: Some characters are obscured by Strong Bad's head. PR-URL: #21646 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent c8d5bab commit 04eed23

File tree

1 file changed

+56
-62
lines changed

1 file changed

+56
-62
lines changed

doc/api/fs.md

+56-62
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ try {
4545
}
4646
```
4747

48-
Note that there is no guaranteed ordering when using asynchronous methods.
49-
So the following is prone to error because the `fs.stat()` operation may
50-
complete before the `fs.rename()` operation.
48+
There is no guaranteed ordering when using asynchronous methods. So the
49+
following is prone to error because the `fs.stat()` operation may complete
50+
before the `fs.rename()` operation:
5151

5252
```js
5353
fs.rename('/tmp/hello', '/tmp/world', (err) => {
@@ -150,8 +150,8 @@ fs.open(Buffer.from('/open/some/file.txt'), 'r', (err, fd) => {
150150
});
151151
```
152152

153-
*Note:* On Windows Node.js follows the concept of per-drive working directory.
154-
This behavior can be observed when using a drive path without a backslash. For
153+
On Windows, Node.js follows the concept of per-drive working directory. This
154+
behavior can be observed when using a drive path without a backslash. For
155155
example `fs.readdirSync('c:\\')` can potentially return a different result than
156156
`fs.readdirSync('c:')`. For more information, see
157157
[this MSDN page][MSDN-Rel-Path].
@@ -278,9 +278,9 @@ eventually cause an application to crash.
278278

279279
## Threadpool Usage
280280

281-
Note that all file system APIs except `fs.FSWatcher()` and those that are
282-
explicitly synchronous use libuv's threadpool, which can have surprising and
283-
negative performance implications for some applications, see the
281+
All file system APIs except `fs.FSWatcher()` and those that are explicitly
282+
synchronous use libuv's threadpool, which can have surprising and negative
283+
performance implications for some applications. See the
284284
[`UV_THREADPOOL_SIZE`][] documentation for more information.
285285

286286
## Class: fs.FSWatcher
@@ -689,15 +689,13 @@ The times in the stat object have the following semantics:
689689
* `birthtime` "Birth Time" - Time of file creation. Set once when the
690690
file is created. On filesystems where birthtime is not available,
691691
this field may instead hold either the `ctime` or
692-
`1970-01-01T00:00Z` (ie, unix epoch timestamp `0`). Note that this
693-
value may be greater than `atime` or `mtime` in this case. On Darwin
694-
and other FreeBSD variants, also set if the `atime` is explicitly
695-
set to an earlier value than the current `birthtime` using the
696-
utimes(2) system call.
692+
`1970-01-01T00:00Z` (ie, unix epoch timestamp `0`). This value may be greater
693+
than `atime` or `mtime` in this case. On Darwin and other FreeBSD variants,
694+
also set if the `atime` is explicitly set to an earlier value than the current
695+
`birthtime` using the utimes(2) system call.
697696

698-
Prior to Node.js v0.12, the `ctime` held the `birthtime` on Windows
699-
systems. Note that as of v0.12, `ctime` is not "creation time", and
700-
on Unix systems, it never was.
697+
Prior to Node.js 0.12, the `ctime` held the `birthtime` on Windows systems. As
698+
of 0.12, `ctime` is not "creation time", and on Unix systems, it never was.
701699

702700
## Class: fs.WriteStream
703701
<!-- YAML
@@ -1117,11 +1115,10 @@ For example, the octal value `0o765` means:
11171115
* The group may read and write the file.
11181116
* Others may read and execute the file.
11191117

1120-
Note: When using raw numbers where file modes are expected,
1121-
any value larger than `0o777` may result in platform-specific
1122-
behaviors that are not supported to work consistently.
1123-
Therefore constants like `S_ISVTX`, `S_ISGID` or `S_ISUID` are
1124-
not exposed in `fs.constants`.
1118+
When using raw numbers where file modes are expected, any value larger than
1119+
`0o777` may result in platform-specific behaviors that are not supported to work
1120+
consistently. Therefore constants like `S_ISVTX`, `S_ISGID` or `S_ISUID` are not
1121+
exposed in `fs.constants`.
11251122

11261123
Caveats: on Windows only the write permission can be changed, and the
11271124
distinction among the permissions of group, owner or others is not
@@ -1373,8 +1370,8 @@ The `encoding` can be any one of those accepted by [`Buffer`][].
13731370

13741371
If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
13751372
the specified file descriptor. This means that no `'open'` event will be
1376-
emitted. Note that `fd` should be blocking; non-blocking `fd`s should be passed
1377-
to [`net.Socket`][].
1373+
emitted. `fd` should be blocking; non-blocking `fd`s should be passed to
1374+
[`net.Socket`][].
13781375

13791376
If `autoClose` is false, then the file descriptor won't be closed, even if
13801377
there's an error. It is the application's responsibility to close it and make
@@ -1437,8 +1434,8 @@ file descriptor leak.
14371434

14381435
Like [`ReadStream`][], if `fd` is specified, [`WriteStream`][] will ignore the
14391436
`path` argument and will use the specified file descriptor. This means that no
1440-
`'open'` event will be emitted. Note that `fd` should be blocking; non-blocking
1441-
`fd`s should be passed to [`net.Socket`][].
1437+
`'open'` event will be emitted. `fd` should be blocking; non-blocking `fd`s
1438+
should be passed to [`net.Socket`][].
14421439

14431440
If `options` is a string, then it specifies the encoding.
14441441

@@ -1468,11 +1465,11 @@ fs.exists('/etc/passwd', (exists) => {
14681465
});
14691466
```
14701467

1471-
**Note that the parameter to this callback is not consistent with other
1472-
Node.js callbacks.** Normally, the first parameter to a Node.js callback is
1473-
an `err` parameter, optionally followed by other parameters. The
1474-
`fs.exists()` callback has only one boolean parameter. This is one reason
1475-
`fs.access()` is recommended instead of `fs.exists()`.
1468+
**The parameters for this callback are not consistent with other Node.js
1469+
callbacks.** Normally, the first parameter to a Node.js callback is an `err`
1470+
parameter, optionally followed by other parameters. The `fs.exists()` callback
1471+
has only one boolean parameter. This is one reason `fs.access()` is recommended
1472+
instead of `fs.exists()`.
14761473

14771474
Using `fs.exists()` to check for the existence of a file before calling
14781475
`fs.open()`, `fs.readFile()` or `fs.writeFile()` is not recommended. Doing
@@ -1568,10 +1565,9 @@ changes:
15681565
Synchronous version of [`fs.exists()`][].
15691566
Returns `true` if the path exists, `false` otherwise.
15701567

1571-
Note that `fs.exists()` is deprecated, but `fs.existsSync()` is not.
1572-
(The `callback` parameter to `fs.exists()` accepts parameters that are
1573-
inconsistent with other Node.js callbacks. `fs.existsSync()` does not use
1574-
a callback.)
1568+
`fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`
1569+
parameter to `fs.exists()` accepts parameters that are inconsistent with other
1570+
Node.js callbacks. `fs.existsSync()` does not use a callback.
15751571

15761572
## fs.fchmod(fd, mode, callback)
15771573
<!-- YAML
@@ -2144,9 +2140,8 @@ fs.mkdtemp(tmpDir, (err, folder) => {
21442140
if (err) throw err;
21452141
console.log(folder);
21462142
// Will print something similar to `/tmpabc123`.
2147-
// Note that a new temporary directory is created
2148-
// at the file system root rather than *within*
2149-
// the /tmp directory.
2143+
// A new temporary directory is created at the file system root
2144+
// rather than *within* the /tmp directory.
21502145
});
21512146

21522147
// This method is *CORRECT*:
@@ -2199,8 +2194,8 @@ changes:
21992194
Asynchronous file open. See open(2).
22002195

22012196
`mode` sets the file mode (permission and sticky bits), but only if the file was
2202-
created. Note that on Windows only the write permission can be manipulated,
2203-
see [`fs.chmod()`][].
2197+
created. On Windows, only the write permission can be manipulated; see
2198+
[`fs.chmod()`][].
22042199

22052200
The callback gets two arguments `(err, fd)`.
22062201

@@ -2838,9 +2833,9 @@ changes:
28382833
Asynchronous symlink(2). No arguments other than a possible exception are given
28392834
to the completion callback. The `type` argument can be set to `'dir'`,
28402835
`'file'`, or `'junction'` and is only available on
2841-
Windows (ignored on other platforms). Note that Windows junction points require
2842-
the destination path to be absolute. When using `'junction'`, the `target`
2843-
argument will automatically be normalized to absolute path.
2836+
Windows (ignored on other platforms). Windows junction points require the
2837+
destination path to be absolute. When using `'junction'`, the `target` argument
2838+
will automatically be normalized to absolute path.
28442839

28452840
Here is an example below:
28462841

@@ -3081,10 +3076,10 @@ The listener callback gets two arguments `(eventType, filename)`. `eventType`
30813076
is either `'rename'` or `'change'`, and `filename` is the name of the file
30823077
which triggered the event.
30833078

3084-
Note that on most platforms, `'rename'` is emitted whenever a filename appears
3085-
or disappears in the directory.
3079+
On most platforms, `'rename'` is emitted whenever a filename appears or
3080+
disappears in the directory.
30863081

3087-
Also note the listener callback is attached to the `'change'` event fired by
3082+
The listener callback is attached to the `'change'` event fired by
30883083
[`fs.FSWatcher`][], but it is not the same thing as the `'change'` value of
30893084
`eventType`.
30903085

@@ -3261,9 +3256,8 @@ The callback will be given three arguments `(err, bytesWritten, buffer)` where
32613256
If this method is invoked as its [`util.promisify()`][]ed version, it returns
32623257
a `Promise` for an `Object` with `bytesWritten` and `buffer` properties.
32633258

3264-
Note that it is unsafe to use `fs.write` multiple times on the same file
3265-
without waiting for the callback. For this scenario,
3266-
`fs.createWriteStream` is strongly recommended.
3259+
It is unsafe to use `fs.write()` multiple times on the same file without waiting
3260+
for the callback. For this scenario, `fs.createWriteStream()` is recommended.
32673261

32683262
On Linux, positional writes don't work when the file is opened in append mode.
32693263
The kernel ignores the position argument and always appends the data to
@@ -3305,12 +3299,12 @@ the current position. See pwrite(2).
33053299
`encoding` is the expected string encoding.
33063300

33073301
The callback will receive the arguments `(err, written, string)` where `written`
3308-
specifies how many _bytes_ the passed string required to be written. Note that
3309-
bytes written is not the same as string characters. See [`Buffer.byteLength`][].
3302+
specifies how many _bytes_ the passed string required to be written. Bytes
3303+
written is not necessarily the same as string characters written. See
3304+
[`Buffer.byteLength`][].
33103305

3311-
Note that it is unsafe to use `fs.write` multiple times on the same file
3312-
without waiting for the callback. For this scenario,
3313-
`fs.createWriteStream` is strongly recommended.
3306+
It is unsafe to use `fs.write()` multiple times on the same file without waiting
3307+
for the callback. For this scenario, `fs.createWriteStream()` is recommended.
33143308

33153309
On Linux, positional writes don't work when the file is opened in append mode.
33163310
The kernel ignores the position argument and always appends the data to
@@ -3367,9 +3361,9 @@ fs.writeFile('message.txt', 'Hello Node.js', 'utf8', callback);
33673361

33683362
Any specified file descriptor has to support writing.
33693363

3370-
Note that it is unsafe to use `fs.writeFile` multiple times on the same file
3371-
without waiting for the callback. For this scenario,
3372-
`fs.createWriteStream` is strongly recommended.
3364+
It is unsafe to use `fs.writeFile()` multiple times on the same file without
3365+
waiting for the callback. For this scenario, `fs.createWriteStream()` is
3366+
recommended.
33733367

33743368
If a file descriptor is specified as the `file`, it will not be closed
33753369
automatically.
@@ -4156,9 +4150,9 @@ Creates a symbolic link then resolves the `Promise` with no arguments upon
41564150
success.
41574151

41584152
The `type` argument is only used on Windows platforms and can be one of `'dir'`,
4159-
`'file'`, or `'junction'`. Note that Windows junction
4160-
points require the destination path to be absolute. When using `'junction'`,
4161-
the `target` argument will automatically be normalized to absolute path.
4153+
`'file'`, or `'junction'`. Windows junction points require the destination path
4154+
to be absolute. When using `'junction'`, the `target` argument will
4155+
automatically be normalized to absolute path.
41624156

41634157
### fsPromises.truncate(path[, len])
41644158
<!-- YAML
@@ -4520,9 +4514,9 @@ string:
45204514
skipping the potentially stale local cache. It has a very real impact on
45214515
I/O performance so using this flag is not recommended unless it is needed.
45224516

4523-
Note that this doesn't turn `fs.open()` or `fsPromises.open()` into a
4524-
synchronous blocking call. If synchronous operation is desired, something
4525-
like `fs.openSync()` should be used.
4517+
This doesn't turn `fs.open()` or `fsPromises.open()` into a synchronous
4518+
blocking call. If synchronous operation is desired, something like
4519+
`fs.openSync()` should be used.
45264520

45274521
* `'w'` - Open file for writing.
45284522
The file is created (if it does not exist) or truncated (if it exists).

0 commit comments

Comments
 (0)