# fs-monkey

> Monkey patches for file system related things.

Latest version **1.1.0** (published 2025-07-18) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install fs-monkey
pnpm add fs-monkey
yarn add fs-monkey
bun add fs-monkey
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2025-07-18 |
| First published | 2017-08-12 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 119 |
| Maintainers | streamich |
| Keywords | fs, file, file system, monkey, fsmonkey, monkeyfs, monkeypatch, patch |

## Links

- npm: https://www.npmjs.com/package/fs-monkey
- Repository: https://github.com/streamich/fs-monkey
- Homepage: https://github.com/streamich/fs-monkey#readme
- Issues: https://github.com/streamich/fs-monkey/issues
- npm.io page: https://npm.io/package/fs-monkey

## 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

- 1.1.0 (latest) — 2025-07-18
- 1.0.6 — 2024-05-01
- 1.0.5 — 2023-09-25
- 1.0.4 — 2023-06-01
- 1.0.3 — 2021-04-05
- 1.0.2 — 2021-04-01
- 1.0.1 — 2020-05-14
- 1.0.0 — 2020-02-17
- 0.4.0 — 2020-02-16
- 0.3.3 — 2018-05-12
- 0.3.2 — 2018-05-11
- 0.3.1 — 2017-12-04
- 0.3.0 — 2017-12-01
- 0.2.2 — 2017-10-22
- 0.2.1 — 2017-09-08
- … 5 more at https://npm.io/package/fs-monkey/versions

## README

# fs-monkey

[![][npm-img]][npm-url] [![][travis-badge]][travis-url]

Monkey-patches for filesystem related things.

  - Rewrite `require` function to load Node's modules from memory.
  - Or rewrite the whole `fs` filesystem module.

## Install

```shell
npm install --save fs-monkey
```

## Terms

An *fs-like* object is an object that implements methods of Node's
[filesystem API](https://nodejs.org/api/fs.html).
It is denoted as `vol`:

```js
let vol = {
    readFile: () => { /* ... */ },
    readFileSync: () => { /* ... */ },
    // etc...
}
```


## Reference

 - [`patchFs`](./docs/api/patchFs.md) - rewrites Node's filesystem module `fs` with *fs-like* object `vol`
 - [`patchRequire`](./docs/api/patchRequire.md) - rewrites `require` function, patches Node's `module` module to use a given *fs-like* object for module loading


[npm-img]: https://img.shields.io/npm/v/fs-monkey.svg
[npm-url]: https://www.npmjs.com/package/fs-monkey
[travis-url]: https://travis-ci.org/streamich/fs-monkey
[travis-badge]: https://travis-ci.org/streamich/fs-monkey.svg?branch=master


## License

[Unlicense](./LICENSE) - public domain.

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