mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
doc: document intention and dangers of fs module Buffer API
PR-URL: https://github.com/nodejs/node/pull/6020 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
committed by
James M Snell
parent
1d9451bb5a
commit
cf29b2f815
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user