1import * as FS from 'FS'
2
3export function writeSync(path, data, options) {
4    if (!path || !data) {
5        throw new Error('params is invalid');
6    }
7    options = options || {flag: 'w'};
8    FS.write(path, data, options);
9}
10
11export function readSync(path) {
12    if(!path) {
13        throw new Error("invalid params");
14    }
15    var content = FS.read(path);
16    if (!content) {
17        throw 'file open error';
18    }
19    return content;
20}
21
22export function unlinkSync(path) {
23    if(!path) {
24        throw new Error("invalid params");
25    }
26    FS.delete(path);
27}
28
29export function totalSize() {
30    return FS.totalSize();
31}
32
33export function usedSize() {
34    return FS.usedSize();
35}
36
37export function freeSize() {
38    return FS.freeSize();
39}
40