Virtual File System for Node.js by mcollina · Pull Request #61478 · nodejs/node

1 min read Original article ↗
Convert FD-based callback functions (close, read, write, fstat,
ftruncate, fdatasync, fsync, fchmod, fchown, futimes, readv, writev)
from sync handler + process.nextTick to async handlers using the
undefined | Promise pattern, matching the approach already used for
path-based operations.

Add async FD handlers to setup.js that call the async methods on
MemoryFileHandle (read, write, stat, truncate, close) instead of
their sync counterparts, avoiding event loop blocking for custom
VFS providers that do real I/O.

Fix vfs.md documentation that was significantly out of date:
- Remove false claim that chmod, chown, truncate, utimes, link,
  fdatasync, fsync have no VFS equivalent (all are implemented)
- Add missing intercepted methods to the fs integration section
  (truncate, link, chmod, chown, lchown, utimes, lutimes, mkdtemp,
  lchmod, cp, statfs, opendir, readv, writev, ftruncate, fchmod,
  fchown, futimes, fdatasync, fsync)
- Shrink "not intercepted" list to just glob/globSync
- Add missing provider.supportsWatch documentation
- Update overlay mode operation routing lists