Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | # fs-monkey
|
---|
2 |
|
---|
3 | [![][npm-img]][npm-url] [![][travis-badge]][travis-url]
|
---|
4 |
|
---|
5 | Monkey-patches for filesystem related things.
|
---|
6 |
|
---|
7 | - Rewrite `require` function to load Node's modules from memory.
|
---|
8 | - Or rewrite the whole `fs` filesystem module.
|
---|
9 |
|
---|
10 | ## Install
|
---|
11 |
|
---|
12 | ```shell
|
---|
13 | npm install --save fs-monkey
|
---|
14 | ```
|
---|
15 |
|
---|
16 | ## Terms
|
---|
17 |
|
---|
18 | An *fs-like* object is an object that implements methods of Node's
|
---|
19 | [filesystem API](https://nodejs.org/api/fs.html).
|
---|
20 | It is denoted as `vol`:
|
---|
21 |
|
---|
22 | ```js
|
---|
23 | let vol = {
|
---|
24 | readFile: () => { /* ... */ },
|
---|
25 | readFileSync: () => { /* ... */ },
|
---|
26 | // etc...
|
---|
27 | }
|
---|
28 | ```
|
---|
29 |
|
---|
30 |
|
---|
31 | ## Reference
|
---|
32 |
|
---|
33 | - [`patchFs`](./docs/api/patchFs.md) - rewrites Node's filesystem module `fs` with *fs-like* object `vol`
|
---|
34 | - [`patchRequire`](./docs/api/patchRequire.md) - rewrites `require` function, patches Node's `module` module to use a given *fs-like* object for module loading
|
---|
35 |
|
---|
36 |
|
---|
37 | [npm-img]: https://img.shields.io/npm/v/fs-monkey.svg
|
---|
38 | [npm-url]: https://www.npmjs.com/package/fs-monkey
|
---|
39 | [travis-url]: https://travis-ci.org/streamich/fs-monkey
|
---|
40 | [travis-badge]: https://travis-ci.org/streamich/fs-monkey.svg?branch=master
|
---|
41 |
|
---|
42 |
|
---|
43 | ## License
|
---|
44 |
|
---|
45 | [Unlicense](./LICENSE) - public domain.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.