Skip to content

What is ZenFS?

ZenFS is a cross-platform library that emulates the Node.js filesystem API. It works using a system of backends, which are used by ZenFS to store and retrieve data.

ZenFS v2.9.0 implements every fs API documented for Node.js v27.0.0. That includes the callback API, the synchronous API, and fs/promises, all with full type compatibility. Complex changes in new Node.js releases may lag a little bit, see Node.js compatibility for the details.

ZenFS is modular and easily extended. Rather than being tied to one storage mechanism, every filesystem is provided by a backend, and backends are mounted into a single tree. The core includes several:

Backend Description
InMemory Stores files in-memory. Cleared when the runtime ends.
CopyOnWrite Combines a readable and a writable file system with copy-on-write.
Fetch Downloads files over HTTP with the fetch API.
Port Interacts with a remote over a MessagePort-like interface, e.g. a worker.
Passthrough Uses an existing node:fs interface with ZenFS.
SingleBuffer Contained within a single buffer. Supports synchronous multi-threaded use with a SharedArrayBuffer.

Many more are provided as separate packages under @zenfs:

You can find all of the packages over on NPM. More backends can be defined by separate libraries, see Writing a backend.

As an added bonus, all ZenFS backends support synchronous operations, and all of the backends included with the core are cross-platform.