fs: add Buffer support in fs methods
Pull Request check-list
Please make sure to review and check all of these items:
-
Does make -j8 test
(UNIX) orvcbuild test nosign
(Windows) pass with this change (including linting)? -
Is the commit message formatted according to [CONTRIBUTING.md][0]? -
If this change fixes a bug (or a performance problem), is a regression test (or a benchmark) included? -
Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
Affected core subsystem(s)
fs (/cc @trevnorris @bnoordhuis )
Description of change
Updated: Reworked the implementation based on @trevnorris feedback. This now does several things:
- Buffer accepted as Path on all fs methods that accept a Path
- {encoding: '...'} option accepted on fs.readdir, fs.readdirSync, fs.readlink, fs.readlinkSync, and fs.watch
- Documentation updates
Fixes: https://github.com/nodejs/node/issues/2088 Ref: https://github.com/nodejs/node/issues/3519 See Also: https://github.com/nodejs/node/pull/3401