node/lib/internal/fs
Livia Medeiros 8009cb0a78 fs: fix write methods param validation and docs
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>
2022-04-07 00:20:46 -05:00
..
cp fs: support copy of relative links with cp and cpSync 2022-02-22 11:38:53 -05:00
dir.js fs: refactor to avoid unsafe array iteration 2021-01-06 11:31:53 +01:00
promises.js fs: fix write methods param validation and docs 2022-04-07 00:20:46 -05:00
read_file_context.js fs: propagate abortsignal reason in new AbortSignal constructors 2021-12-13 17:14:09 -05:00
rimraf.js fs: fix rmsync error swallowing 2021-05-25 07:18:05 -07:00
streams.js fs: make open and close stream override optional when unused 2021-09-17 00:45:08 +02:00
sync_write_stream.js fs: refactor to use more primordials 2020-11-27 18:40:51 +01:00
utils.js fs: fix write methods param validation and docs 2022-04-07 00:20:46 -05:00
watchers.js fs: propagate abortsignal reason in new AbortSignal constructors 2021-12-13 17:14:09 -05:00