mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
promisify(fs.X) over a named or namespace import of node:fs lowers as the fs/promises member of the same name for access, appendFile, chmod, chown, copyFile, lchown, link, lstat, lutimes, mkdir, mkdtemp, readFile, readdir, readlink, realpath, rename, rm, rmdir, stat, statfs, symlink, truncate, unlink, utimes and writeFile. For these, Node's promisified callback form settles with the callback's single result and rejects with the same errors as the fs/promises call. Calls through the bound function accept the forms the fs/promises lowering accepts and refuse the others by name. fs.open (an fd number where fs/promises.open gives a FileHandle), fs.exists (a custom promisify) and fs.read/fs.write (multi-value callbacks) remain refused.