1 | # File System Wrapper
|
2 |
|
3 | ## Ussage
|
4 | ```js
|
5 | const Bfs = require('bfs');
|
6 |
|
7 | const file = Bfs('data.txt');
|
8 |
|
9 | file.write('Hello world');
|
10 | file.read(console.log) // logs the content
|
11 | ```
|
12 |
|
13 | ## API
|
14 | 1. Bfs(name)
|
15 | `name`: The name of the file.
|
16 | if the file doesn't exist will throw an exception.
|
17 |
|
18 | 2. read(fn)
|
19 | `fn`: the callback to be passed.
|
20 | If an error occurs while reading the file it will throw an exception.
|
21 |
|
22 | 3. write(data)
|
23 | `data`: the data to be putted into the file.
|
24 | If an error occurs while writing to the file it will throw an exception.
|