The FS docs wrongfully indicated support for passing object with an own `toString` function property to `FileHandle.prototype.appendFile`, `FileHandle.prototype.writeFile`, `FileHandle.prototype.write`, `fsPromises.writeFile`, and `fs.writeSync`. This commit fixes that, and adds some test to ensure the actual behavior is aligned with the docs. It also fixes a bug that makes the process crash if a non-buffer object was passed to `FileHandle.prototype.write`. Refs: https://github.com/nodejs/node/pull/34993 PR-URL: https://github.com/nodejs/node/pull/41677 Backport-PR-URL: https://github.com/nodejs/node/pull/42631 Refs: https://github.com/nodejs/node/issues/41666 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> |
||
|---|---|---|
| .. | ||
| cp | ||
| dir.js | ||
| promises.js | ||
| read_file_context.js | ||
| rimraf.js | ||
| streams.js | ||
| sync_write_stream.js | ||
| utils.js | ||
| watchers.js | ||