Skip to content

Commit

Permalink
doc: clarify FileHandle text
Browse files Browse the repository at this point in the history
There is a paragraph about why the promise-based API uses `FileHandle`
rather than a numeric `fd`. Unfortunately, the paragraph is a bit of
word-salad. Edit it for clarity, grammar, and style.

PR-URL: #20450
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed May 4, 2018
1 parent 5a839b9 commit fcc5492
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3378,11 +3378,11 @@ and will emit a process warning, thereby helping to prevent memory leaks.
Instances of the `FileHandle` object are created internally by the
`fsPromises.open()` method.

Unlike callback-based such as `fs.fstat()`, `fs.fchown()`, `fs.fchmod()`,
`fs.ftruncate()`, `fs.read()`, and `fs.write()`, operations — all of which
use a simple numeric file descriptor, all `fsPromises.*` variations use the
`FileHandle` class in order to help protect against accidental leaking of
unclosed file descriptors after a `Promise` is resolved or rejected.
Unlike the callback-based API (`fs.fstat()`, `fs.fchown()`, `fs.fchmod()`, and
so on), a numeric file descriptor is not used by the promise-based API. Instead,
the promise-based API uses the `FileHandle` class in order to help avoid
accidental leaking of unclosed file descriptors after a `Promise` is resolved or
rejected.

#### filehandle.appendFile(data, options)
<!-- YAML
Expand Down

0 comments on commit fcc5492

Please sign in to comment.