# @zenfs/core

> A filesystem, anywhere

Latest version **2.9.0** (published 2026-11-04) · LGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @zenfs/core
pnpm add @zenfs/core
yarn add @zenfs/core
bun add @zenfs/core
```

Provides the commands `zci`, `make-index`, `zenfs-test`.

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.9.0 |
| Published | 2026-11-04 |
| First published | 2024-03-22 |
| Weekly downloads | 0 |
| License | LGPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 18 |
| Dependencies | 7 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 431 |
| Author | James Prevett |
| Maintainers | james-pre |
| Keywords | filesystem, node, storage, fs, browser |

## Links

- npm: https://www.npmjs.com/package/@zenfs/core
- Repository: https://github.com/zen-fs/core
- Homepage: https://zenfs.dev/core
- Issues: https://github.com/zen-fs/core/issues
- Funding: https://github.com/sponsors/james-pre
- npm.io page: https://npm.io/package/@zenfs/core

## Dependencies (7)

- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [kerium](https://npm.io/package/kerium.md) ^1.5.0
- [memium](https://npm.io/package/memium.md) ^1.1.0
- [utilium](https://npm.io/package/utilium.md) ^3.7.0
- [@types/node](https://npm.io/package/@types/node.md) ^26.6.0
- [eventemitter3](https://npm.io/package/eventemitter3.md) ^5.0.1
- [@zenfs/streams](https://npm.io/package/@zenfs/streams.md) ^1.0.2

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.9.0 (latest) — 2026-11-04
- 2.8.3 — 2026-10-28
- 2.8.2 — 2026-10-28
- 2.8.1 — 2026-10-28
- 2.8.0 — 2026-10-26
- 2.7.7 — 2026-10-10
- 2.7.6 — 2026-09-12
- 2.7.5 — 2026-09-11
- 2.7.4 — 2026-09-09
- 2.7.3-newstreams.0 — 2026-09-08
- 2.7.3 — 2026-09-07
- 2.7.2 — 2026-09-05
- 2.7.1 — 2026-09-03
- 2.7.0 — 2026-09-01
- 2.6.6 — 2026-08-31
- … 220 more at https://npm.io/package/@zenfs/core/versions

## README

# ZenFS

ZenFS is a cross-platform library that emulates the [Node.js filesystem API](http://nodejs.org/api/fs.html).
It works using a system of backends, which are used by ZenFS to store and retrieve data.
ZenFS should cover the full API surface of the latest Node.js version, though complex changes may lag a little bit.

## Backends

ZenFS is modular and easily extended. The core includes some built-in backends:

- `InMemory`: Stores files in-memory. This is cleared when the runtime ends (e.g. a user navigating away from a web page or a Node process exiting)
- `CopyOnWrite`: Use readable and writable file systems with [copy-on-write](https://en.wikipedia.org/wiki/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`: Use an existing `node:fs` interface with ZenFS
- `SingleBuffer`: A backend contained within a single buffer. Can be used for synchronous multi-threaded operations using `SharedArrayBuffer`

ZenFS supports a number of other backends.
Many are provided as separate packages under `@zenfs`.
More backends can be defined by separate libraries by extending the `FileSystem` class and providing a `Backend` object.

You can find all of the packages available over on [NPM](https://www.npmjs.com/org/zenfs). Below is a list of the backends included with some of them:

- @zenfs/archives: `Zip`, `Iso`
- @zenfs/cloud: `Dropbox`, `GoogleDrive`, `S3Bucket`
- @zenfs/dom: `WebAccess` (Web [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API)/OPFS), `IndexedDB`, `WebStorage` (`localStorage`/`sessionStorage`), `XML` (DOM elements)
- @zenfs/emscripten: `Emscripten` and a plugin for Emscripten's file system API

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

For more information, see the [docs](https://zenfs.dev/core).

## Installing

```sh
npm install @zenfs/core
```

If you're using ZenFS, especially for big projects, please consider supporting the project.
Thousands of hours have been dedicated to its development.
Your financial support would go a long way toward improving ZenFS and its community.

## Usage

> [!IMPORTANT]
> **[Check out the ZenFS docs!](https://zenfs.dev/start/usage/)**

```js
import { fs } from '@zenfs/core'; // You can also use the default export

fs.writeFileSync('/test.txt', 'You can do this anywhere, including browsers!');

const contents = fs.readFileSync('/test.txt', 'utf-8');
console.log(contents);
```

A single `InMemory` backend is created by default, mounted on `/`. To use different backends, and to
mount more than one, configure ZenFS with `configure`. This mounts a zip file to `/mnt/zip`,
in-memory storage to `/tmp`, and IndexedDB to `/home`:

```js
import { configure, InMemory } from '@zenfs/core';
import { IndexedDB } from '@zenfs/dom';
import { Zip } from '@zenfs/archives';

const res = await fetch('mydata.zip');

await configure({
	mounts: {
		'/mnt/zip': { backend: Zip, data: await res.arrayBuffer() },
		'/tmp': InMemory,
		'/home': IndexedDB,
	},
});
```

The `fs/promises` API is available from `@zenfs/core/promises`, as the `promises` export, or as
`fs.promises`.

For the full usage guide, see **[the documentation](https://zenfs.dev/start/usage/)**.
This includes mounting at runtime, contexts and permissions, devices, and the `node:*`module emulation.

## Bundling

ZenFS exports a drop-in for Node's `fs` module, so you can use it for your bundler of preference using the default export.
See [COPYING.md](./COPYING.md) for more info.

## Sponsors

A huge thank you to [deco.cx](https://github.com/deco-cx) for sponsoring ZenFS and helping to make this possible.

## Contact and Support

You can reach out [on Discord](https://zenfs.dev/discord) or by emailing jp@zenfs.dev

## License

[ZenFS](https://github.com/zen-fs/core) is licensed under the [LGPL 3.0 or later](https://www.gnu.org/licenses/lgpl-3.0.html) and [COPYING.md](https://github.com/zen-fs/core/blob/main/COPYING.md).
Copyright © James Prevett and other ZenFS contributors.

---
_Source: https://npm.io/package/@zenfs/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
