node/lib/internal/fs
Livia Medeiros 75302d3dce 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
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>
Backport-PR-URL: https://github.com/nodejs/node/pull/42603
2022-05-01 16:44:20 -05:00
..
dir.js fs: pass ERR_DIR_CLOSED asynchronously to dir.close 2021-05-01 09:44:33 +02:00
promises.js fs: fix write methods param validation and docs 2022-05-01 16:44:20 -05:00
read_file_context.js fs: move constants to internal/fs/utils.js 2021-09-04 08:47:00 +02:00
rimraf.js fs: rimraf should not recurse on failure 2020-10-14 16:21:28 -04:00
streams.js stream: the position of _read() is wrong 2021-06-11 09:30:12 +02:00
sync_write_stream.js lib: flatten access to primordials 2019-11-25 10:28:15 +01:00
utils.js fs: fix write methods param validation and docs 2022-05-01 16:44:20 -05:00
watchers.js fs: add fsPromises.watch() 2021-09-01 23:21:32 +02:00