xfs
xfs is a module extends build-in fs module, let file manipulate easily
xfs extends the following functions :
async functions
- mkdir(path,cb) make directories and their contents recursively
- rmdir(path,cb) remove directories and their contents recursively
- rename(src,dest,cb) rename file across two different devices
- walk(dir, expr, each, done); walk through dir, each file will pass to each() , when walk done, done() called
// walk traverse through files in the dir one by one// get only js files in dirfs; // function walk() can also accept an `function type` exprfs; // or you can save the done function fs;
sync functions
- rm(path)
- mkdir(path)
- save(path, data[, options|encoding])
var sync = xfs;// shell > rm -r pathsync;// shell > mkdir -p pathsync;// save file auto create dir if not exist// node >= v0.10.0sync; // when node >= v0.10.0, the last param is optionsync; // when node < v0.10.0, the last param is encoding
... to be contine
symlink file, rm will failed
License
MIT