# xfs

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

Latest version **0.2.6** (published 2018-08-25) · 0 weekly downloads

## Install

```sh
npm install xfs
pnpm add xfs
yarn add xfs
bun add xfs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2018-08-25 |
| First published | 2012-02-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 0 |
| Unpacked size | 22.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | fish |
| Maintainers | fish, fishbar, yuzhigang33 |

## Links

- npm: https://www.npmjs.com/package/xfs
- Repository: https://github.com/fishbar/xfs
- Issues: https://github.com/fishbar/xfs/issues
- npm.io page: https://npm.io/package/xfs

## Recent versions

- 0.2.6 (latest) — 2018-08-25
- 0.2.5 — 2018-08-25
- 0.2.4 — 2018-05-24
- 0.2.3 — 2018-03-07
- 0.2.2 — 2017-10-28
- 0.2.1 — 2016-03-07
- 0.2.0 — 2015-07-26
- 0.1.10 — 2014-07-17
- 0.1.9 — 2014-05-27
- 0.1.8 — 2014-05-11
- 0.1.7 — 2014-04-08
- 0.1.6 — 2014-03-27
- 0.1.4 — 2013-11-27
- 0.1.3 — 2013-04-01
- 0.1.2 — 2012-07-11
- … 2 more at https://npm.io/package/xfs/versions

## README

xfs
======

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

[![Build Status](https://secure.travis-ci.org/fishbar/xfs.png)](http://travis-ci.org/fishbar/xfs)


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

```js
// 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
});

// 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])
  
```js
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

## symlink file, rm will failed

## License

  MIT

---
_Source: https://npm.io/package/xfs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
