joyent/node — pull request #8522 by jwueller (2014-10-06 18:26:32+00:00)
Title: fs: Add file descriptor support to *File() funcs

These changes affect the following functions and their synchronous
counterparts:

* fs.readFile()
* fs.writeFile()
* fs.appendFile()

If the first parameter is a String (i.e. a path), the original
implementation is used. Otherwise, a file descriptor is assumed. File
descriptor ownership is never taken from the user.

The documentation was adjusted to reflect these API changes. A note was
added to make the user aware of file descriptor ownership and the
conditions under which a file descriptor can be used by each of these
functions.

Tests were extended to test for file descriptor parameters under the
conditions noted in the relevant documentation.