Skip to content

Commit

Permalink
doc: document intention and dangers of fs module Buffer API
Browse files Browse the repository at this point in the history
PR-URL: #6020
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
seishun authored and Myles Borins committed Apr 20, 2016
1 parent a6056c4 commit 3b00d7a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/api/fs.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ Error: EISDIR, read
<etc.>
```

## Buffer API

`fs` functions support passing and receiving paths as both strings
and Buffers. The latter is intended to make it possible to work with
filesystems that allow for non-UTF-8 filenames. For most typical
uses, working with paths as Buffers will be unnecessary, as the string
API converts to and from UTF-8 automatically.

*Note* that on certain file systems (such as NTFS and HFS+) filenames
will always be encoded as UTF-8. On such file systems, passing
non-UTF-8 encoded Buffers to `fs` functions will not work as expected.

## Class: fs.FSWatcher

Objects returned from `fs.watch()` are of this type.
Expand Down

0 comments on commit 3b00d7a

Please sign in to comment.