Skip to content

Commit f886010

Browse files
author
vad
committed
reme
1 parent 21e9fd2 commit f886010

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

README.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,32 @@
22

33
Monkey-patches for file system related things.
44

5-
> **Terms**
6-
>
7-
> An *fs-like* object is an object that implements methods that correspond
8-
> to [File System API of Node.js](https://nodejs.org/api/fs.html#fs_buffer_api), like:
9-
>
10-
> ```js
11-
> let vol = {
12-
> readFileSync: () => { /* ... */ },
13-
> // etc...
14-
> }
15-
> ```
16-
>
17-
> It is denoted below as the `vol` parameter.
5+
**Terms**
6+
7+
An *fs-like* object is an object that implements methods that correspond
8+
to [File System API of Node.js](https://nodejs.org/api/fs.html#fs_buffer_api).
9+
It is denoted below as the `vol` parameter.
10+
11+
```js
12+
let vol = {
13+
readFileSync: () => { /* ... */ },
14+
// etc...
15+
}
16+
```
17+
18+
19+
**API**
20+
21+
- [`patchFs(vol[, fs])`](#patchfsvol-fs) - rewrites Node's file system module `fs` with *fs-like* object
22+
- [`patchRequire(vol[, Module])`](#patchrequirevol-module) - patches Node's `module` module to use a give *fs-like* for module loading
1823

1924

2025
## `patchFs(vol[, fs])`
2126

22-
Patches Node's file system module `fs.js`.
27+
rewrites Node's file system module `fs` with *fs-like* object.
2328

24-
- `vol` -- fs-like object
25-
- `fs` -- a file system to patch, defaults to `require('fs')`
29+
- `vol` - fs-like object
30+
- `fs` - a file system to patch, defaults to `require('fs')`
2631

2732
```js
2833
import {vol} from '../../../memfs/lib';
@@ -36,10 +41,10 @@ console.log(require('fs').readdirSync('/')); // [ 'dir' ]
3641

3742
## `patchRequire(vol[, Module])`
3843

39-
Patches Node's `require` function.
44+
patches Node's `module` module to use a give *fs-like* for module loading.
4045

41-
- `vol` -- fs-like object
42-
- `Module` -- a module to patch, defaults to `require('module')`
46+
- `vol` - fs-like object
47+
- `Module` - a module to patch, defaults to `require('module')`
4348

4449
Monkey-patches the `require` function of Node.js, this way you can make
4550
Node.js to *require* modules from your custom file system.

0 commit comments

Comments
 (0)