Skip to main content

Module fs

Module fs 

Source
Expand description

Node fs module: synchronous file operations, the async callback forms, and the file-descriptor / directory / stream / watcher surfaces.

Path operations map straight onto std::fs; descriptor operations (open/read/write/fstat/…) keep a thread-local table of open std::fs::Files keyed by a synthetic integer fd (starting at 3, after the stdio fds). Ownership / timestamp / statvfs operations that std::fs does not cover use libc directly (all targets are unix). Async callback variants run the same synchronous work then schedule the callback as a microtask, matching Node’s ordering for simple scripts.

Constants§

DIRENT_METHODS
DIR_METHODS
METHODS
READ_STREAM_METHODS
WRITE_STREAM_METHODS

Functions§

call
dir_call
fs.Dir method dispatch (tag Dir); path is a plain data property.
dirent_call
fs.Dirent method dispatch (tag Dirent); name/parentPath/path are plain data properties resolved by the generic object path.
read_stream_call
fs.ReadStream instance dispatch (tag FSReadStream). Emitter methods are handled by the parent’s shared emitter routing; this covers the stream-only surface.
stats_call
fs.Stats method dispatch (isFile/isDirectory/…).
write_stream_call
fs.WriteStream instance dispatch (tag FSWriteStream).