UNPKG

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