Skip to content

Commit f545ae9

Browse files
committed
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: nodejs#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 e55bdde commit f545ae9

File tree

1 file changed

+56
-62
lines changed

1 file changed

+56
-62
lines changed

doc/api/fs.md

Lines changed: 56 additions & 62 deletions
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
@@ -1378,8 +1375,8 @@ The `encoding` can be any one of those accepted by [`Buffer`][].
13781375

13791376
If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
13801377
the specified file descriptor. This means that no `'open'` event will be
1381-
emitted. Note that `fd` should be blocking; non-blocking `fd`s should be passed
1382-
to [`net.Socket`][].
1378+
emitted. `fd` should be blocking; non-blocking `fd`s should be passed to
1379+
[`net.Socket`][].
13831380

13841381
If `autoClose` is false, then the file descriptor won't be closed, even if
13851382
there's an error. It is the application's responsibility to close it and make
@@ -1442,8 +1439,8 @@ file descriptor leak.
14421439

14431440
Like [`ReadStream`][], if `fd` is specified, [`WriteStream`][] will ignore the
14441441
`path` argument and will use the specified file descriptor. This means that no
1445-
`'open'` event will be emitted. Note that `fd` should be blocking; non-blocking
1446-
`fd`s should be passed to [`net.Socket`][].
1442+
`'open'` event will be emitted. `fd` should be blocking; non-blocking `fd`s
1443+
should be passed to [`net.Socket`][].
14471444

14481445
If `options` is a string, then it specifies the encoding.
14491446

@@ -1473,11 +1470,11 @@ fs.exists('/etc/passwd', (exists) => {
14731470
});
14741471
```
14751472

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

14821479
Using `fs.exists()` to check for the existence of a file before calling
14831480
`fs.open()`, `fs.readFile()` or `fs.writeFile()` is not recommended. Doing
@@ -1573,10 +1570,9 @@ changes:
15731570
Synchronous version of [`fs.exists()`][].
15741571
Returns `true` if the path exists, `false` otherwise.
15751572

1576-
Note that `fs.exists()` is deprecated, but `fs.existsSync()` is not.
1577-
(The `callback` parameter to `fs.exists()` accepts parameters that are
1578-
inconsistent with other Node.js callbacks. `fs.existsSync()` does not use
1579-
a callback.)
1573+
`fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`
1574+
parameter to `fs.exists()` accepts parameters that are inconsistent with other
1575+
Node.js callbacks. `fs.existsSync()` does not use a callback.
15801576

15811577
## fs.fchmod(fd, mode, callback)
15821578
<!-- YAML
@@ -2149,9 +2145,8 @@ fs.mkdtemp(tmpDir, (err, folder) => {
21492145
if (err) throw err;
21502146
console.log(folder);
21512147
// Will print something similar to `/tmpabc123`.
2152-
// Note that a new temporary directory is created
2153-
// at the file system root rather than *within*
2154-
// the /tmp directory.
2148+
// A new temporary directory is created at the file system root
2149+
// rather than *within* the /tmp directory.
21552150
});
21562151

21572152
// This method is *CORRECT*:
@@ -2204,8 +2199,8 @@ changes:
22042199
Asynchronous file open. See open(2).
22052200

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

22102205
The callback gets two arguments `(err, fd)`.
22112206

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

28502845
Here is an example below:
28512846

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

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

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

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

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

32733267
On Linux, positional writes don't work when the file is opened in append mode.
32743268
The kernel ignores the position argument and always appends the data to
@@ -3310,12 +3304,12 @@ the current position. See pwrite(2).
33103304
`encoding` is the expected string encoding.
33113305

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

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

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

33733367
Any specified file descriptor has to support writing.
33743368

3375-
Note that it is unsafe to use `fs.writeFile` multiple times on the same file
3376-
without waiting for the callback. For this scenario,
3377-
`fs.createWriteStream` is strongly recommended.
3369+
It is unsafe to use `fs.writeFile()` multiple times on the same file without
3370+
waiting for the callback. For this scenario, `fs.createWriteStream()` is
3371+
recommended.
33783372

33793373
If a file descriptor is specified as the `file`, it will not be closed
33803374
automatically.
@@ -4161,9 +4155,9 @@ Creates a symbolic link then resolves the `Promise` with no arguments upon
41614155
success.
41624156

41634157
The `type` argument is only used on Windows platforms and can be one of `'dir'`,
4164-
`'file'`, or `'junction'`. Note that Windows junction
4165-
points require the destination path to be absolute. When using `'junction'`,
4166-
the `target` argument will automatically be normalized to absolute path.
4158+
`'file'`, or `'junction'`. Windows junction points require the destination path
4159+
to be absolute. When using `'junction'`, the `target` argument will
4160+
automatically be normalized to absolute path.
41674161

41684162
### fsPromises.truncate(path[, len])
41694163
<!-- YAML
@@ -4525,9 +4519,9 @@ string:
45254519
skipping the potentially stale local cache. It has a very real impact on
45264520
I/O performance so using this flag is not recommended unless it is needed.
45274521

4528-
Note that this doesn't turn `fs.open()` or `fsPromises.open()` into a
4529-
synchronous blocking call. If synchronous operation is desired, something
4530-
like `fs.openSync()` should be used.
4522+
This doesn't turn `fs.open()` or `fsPromises.open()` into a synchronous
4523+
blocking call. If synchronous operation is desired, something like
4524+
`fs.openSync()` should be used.
45314525

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

0 commit comments

Comments
 (0)