Socket
Socket
Sign inDemoInstall

xfs

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xfs

extends fs module, easy way to manipulate file system, support both sync functions and async functions


Version published
Maintainers
2
Created
Source

xfs

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()
  done();
}, function (err) {
  // your code
});

// 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
sync.rm(path);
// shell > mkdir -p path
sync.mkdir(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

License

MIT

FAQs

Package last updated on 17 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc