Extended native file system library adopted for Promise object.
See https://nodejs.org/dist/latest-v5.x/docs/api/fs.html. All callback functions returns Promise object instead of call callback
function.
Resolve Promise object with Array
of all files pathes filtered by optional RegExp.
var fs = require('nano-fs');
fs.listFiles('./source').then(function (list) {
console.log(list);
});
Prints something like
[ "tet.jk", "a/file.txt", "a/fileaa" ]
Write objects tree to file system tree.
fs.writeTree('./test', {
folder_a: {
'file_a.txt': 'content',
'file_b.txt': 'content'
},
folder_b: {
},
'file_c.txt': 'content'
});
Resolve a Promise with objects tree where folders will be objects contains files as strings.
fs.readTree(path).then(function (o) {
console.log(o);
});
Copy file to another location. If destination path does not exists it will be created by mkpath() call.
Recursively remove folder. It can remove file too.
Empty folder. Try it! :)