github zen-fs/core v2.6.0
2.6.0

6 hours ago

Hey everyone! This release includes a ton of bug fixes and improvements.

1. Better VFS integrity and syncing (#288)

The VFS now keeps a cache of vnodes for each file system, the vcache. vnodes are locked for reads and writes, meaning two write operations can't access the same inode concurrently. This fixes #256, #287, and #298.

2. Node.js compatibility (#300)

3478fb6 added a way to run the full test suite used by backends (tests/fs) against the native node:fs module. This lead to quite a few bug fixes:

  • Fixed watchFile not adding the first listener to the listeners set used by statWatchers
  • Fixed context not being passed to stat calls in StatWatcher
  • Fixed fs.watch not respecting abort signal
  • Fixed incorrect watch event emission
  • Fixed invalid file descriptors throwing EBADF instead of ERR_OUT_OF_RANGE
  • Fixed Dir.close being idempotent since it shouldn't be
  • Fixed recursive readdir returning parentPath relative to the target instead of joined with the requested path
  • Fixed renaming a directory inside itself throwing EBUSY instead of EINVAL
  • Fixed mkdtemp() with a relative prefix createing the directory in /tmp instead of relative to the cwd
  • Fixed ReadStream.close() not passing a "Premature close" error to its callback
  • Fixed createReadStream with an end option reading one byte off
  • Fixed link and linkSync path and dest in error being swapped
  • Fixed error syscalls not matching Node.js (#265)

3. Changes to testing

  • Added a setup for running tests against the native node:fs module
  • Added test flags and configuration (#228)
  • Fixed watch tests to reflect actual node event behavior
  • Fixed underscore names (e.g. _setup-example.ts) causing explicitly passed setup files to be skipped by zenfs-test
  • Fixed tests for mkdtemp not using /tmp
  • Error tests now test the syscall as well
  • Test commands now use execFileSync instead of execSync for more input safety
  • Tests are now more agnostic as to the fs implementation
  • Added JSDoc types to scripts (test, ci, make-index, etc.)
  • Added --silent to test commands to fix issues with npm v12 output
  • Increased max timeout for tests to avoid failures in slower environments (like CI/CD)

The changes to the watch API fixes some issues with cleanup. That now means tests complete up to 3x faster! (at least on my machine)

4. Misc

  • StoreFS now updates the inode atomically (#286)
  • Replaced Iterator helpers with spread for compatibility with <ES2025 (#296, thanks @jcubic)
  • Fixed streaming reads and writes going directly to the backend. They now go through Handle.
  • Fixed ino collisions in CopyOnWrite
  • Renamed internal single buffer Lock type to SBLock
  • Narrowed the return type of methods from InodeLike to Inode for StoreFS, DeviceFS, and IndexFS

Don't miss a new core release

NewReleases is sending notifications on new releases.