Files
scriptc/tests
Chris Tate a5eca18f1e Read fs.promises as a module, end CommonJS entries at a top-level return, and check fs read and write arguments as Node does
fs.promises read as a member of the fs module (a binding, an inline
require('fs').promises, destructuring) is the node:fs/promises namespace,
as in Node. It failed at run time before.

A return at the top level of the entry CommonJS module ends its
evaluation, as in Node's module wrapper: preflight admits TS1108 in
CommonJS JavaScript files. A CommonJS module the program requires with a
top-level return is refused with SC1090, because the exports assigned
after the return would stay undefined, which their storage cannot hold.

fs.ReadStream(...) and fs.WriteStream(...) called without new construct
their stream, as Node's stream constructors do.

fs.read, fs.readSync and fs.write check their arguments in Node's order
and with Node's errors: the fd, the buffer, the offset, `length |= 0`,
number and bigint positions (validatePosition), the empty-buffer error
and the buffer window. fs.read accepts a Proxy options object. A
readSync call whose JavaScript arguments are untyped or bigint takes the
same checks at run time (fs.readSyncDyn). fs.write threw no error for an
invalid fd, offset or length before.
2026-10-24 07:22:00 -05:00
..
2026-10-23 05:57:14 -05:00
…