node:fs

#Import

import fs from "nstdlib/node/fs";

Note

Behaves like Node.js. Over a node:vfs memory mount. Paths outside a mount still throw.

#Support

node:fs. nstd: works; Node test suite 92.4% passing. Browser: works; export coverage 100%; Node test suite 85.6% passing.

  • nstd: Gives the same output as Node.js in side-by-side tests: fs, fs-watch.
  • Browser: Loads with a minimal process object. 103 of Node's 103 exports are available. 1 of 1 behavior checks match Node.js.

#Exports (105)

Every name Node.js exports from this module, and what you get when you read it, as a named import or as a property of the default import:

  • ✅ A value, both ways. An export that throws an error naming the missing feature also counts.
  • ⚠️ A value one way, undefined the other.
  • ❔ undefined both ways.
  • ❌ Not exported at all.
  • – Not measured.
Show all 105 exports
ExportNode.jsBrowser
Dir✅✅
Dirent✅✅
FileReadStream✅✅
FileWriteStream✅✅
ReadStream✅✅
Stats✅✅
Utf8Stream✅✅
WriteStream✅✅
_toUnixTimestamp✅✅
access✅✅
accessSync✅✅
appendFile✅✅
appendFileSync✅✅
chmod✅✅
chmodSync✅✅
chown✅✅
chownSync✅✅
close✅✅
closeSync✅✅
constants✅✅
copyFile✅✅
copyFileSync✅✅
cp✅✅
cpSync✅✅
createReadStream✅✅
createWriteStream✅✅
exists✅✅
existsSync✅✅
fchmod✅✅
fchmodSync✅✅
fchown✅✅
fchownSync✅✅
fdatasync✅✅
fdatasyncSync✅✅
fstat✅✅
fstatSync✅✅
fsync✅✅
fsyncSync✅✅
ftruncate✅✅
ftruncateSync✅✅
futimes✅✅
futimesSync✅✅
glob✅✅
globSync✅✅
lchmod❔❌
lchmodSync❔❌
lchown✅✅
lchownSync✅✅
link✅✅
linkSync✅✅
lstat✅✅
lstatSync✅✅
lutimes✅✅
lutimesSync✅✅
mkdir✅✅
mkdirSync✅✅
mkdtemp✅✅
mkdtempDisposableSync✅✅
mkdtempSync✅✅
open✅✅
openAsBlob✅✅
openAsBlobSync✅✅
openSync✅✅
opendir✅✅
opendirSync✅✅
promises✅✅
read✅✅
readFile✅✅
readFileSync✅✅
readSync✅✅
readdir✅✅
readdirSync✅✅
readlink✅✅
readlinkSync✅✅
readv✅✅
readvSync✅✅
realpath✅✅
realpathSync✅✅
rename✅✅
renameSync✅✅
rm✅✅
rmSync✅✅
rmdir✅✅
rmdirSync✅✅
stat✅✅
statSync✅✅
statfs✅✅
statfsSync✅✅
symlink✅✅
symlinkSync✅✅
truncate✅✅
truncateSync✅✅
unlink✅✅
unlinkSync✅✅
unwatchFile✅✅
utimes✅✅
utimesSync✅✅
watch✅✅
watchFile✅✅
write✅✅
writeFile✅✅
writeFileSync✅✅
writeSync✅✅
writev✅✅
writevSync✅✅

#Diagnostics

nstdlib running inside Node.js. This isn't an environment it's meant for, so it isn't shown above, but it tells a library problem from an environment one:

  • coverage: 105/105 of the host's export names answer inside host node. Behaviour verified against the host builtin. Over a node:vfs memory mount. Paths outside a mount still throw.
  • smoke: Imports in a clean child process.
  • node-suite: 270/367 of Node's own eligible tests pass with ./dist inside host node. A failure there and in the page is the library's, one only in the page is the engine's.