-
Notifications
You must be signed in to change notification settings - Fork 0
/
dirfs.js
59 lines (44 loc) · 1.12 KB
/
dirfs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var fs = require('nano-fs'),
Path = require('path');
function DirFS(path) {
this.folder = path;
}
DirFS.prototype = {
complete: function (path) {
return Path.join(this.folder, path);
},
readFile: function (path, opts) {
return fs.readFile(this.complete(path), opts);
},
writeFile: function (path, data, opts) {
return fs.writeFile(this.complete(path), data, opts);
},
copy: function (src, dst) {
return fs.copy(this.complete(src), this.complete(dst));
},
stat: function (path) {
return fs.stat(this.complete(path));
},
unlink: function (path) {
return fs.unlink(this.complete(path));
},
listFiles: function (path, re) {
return fs.listFiles(this.complete(path), re);
},
mkdir: function (path, mode) {
return fs.mkdir(this.complete(path), mode);
},
mkpath: function (path, mode) {
return fs.mkpath(this.complete(path), mode);
},
empty: function (path) {
return fs.empty(this.complete(path));
},
readTree: function (path) {
return fs.readTree(this.complete(path));
},
writeTree: function (path, obj) {
return fs.writeTree(this.complete(path), obj);
}
};
module.exports = DirFS;