extends fs module,Node.js file module
JavaScript Makefile
Switch branches/tags
Failed to load latest commit information.
lib Added Untitled Diagram.xml Jul 5, 2017
test fix test case: process.env; and ignore node 0.8 Nov 8, 2015
.gitignore fix xfs.walk bug, change test coverage May 11, 2014
.jshintrc fix xfs.walk bug, change test coverage May 11, 2014
LICENSE add full license text May 21, 2014
README.md update walk function ,now support function expr Jul 26, 2015
index.js fix xfs.walk May 27, 2014
package.json fix empty link file bug Mar 7, 2016



xfs is a module extends builded-in fs module, let file manipulate easily

Build Status

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 dir
fs.walk(dir, /\.js$/, function (err, file, done) {
  // your code here

  // in the end , must call done()
}, function (err) {
  // your code

// function walk() can also accept an `function type` expr
fs.walk(dir, function (fpath) {
  // return bool, true means accept, false means ignore
  return true
}, function (err, file, done) {

}, function (err) {


// or you can save the done function

fs.walk(dir, /\.js$/, function (err, file){
  // your code here

sync functions

  • rm(path)
  • mkdir(path)
  • save(path, data[, options|encoding])
var sync = xfs.sync();
// shell > rm -r path
// shell > mkdir -p path
// save file auto create dir if not exist
// node >= v0.10.0
sync.save(path, data, option); // when node >= v0.10.0, the last param is option
sync.save(path, data, encoding); // when node < v0.10.0, the last param is encoding

... to be contine

symlink file, rm will failed