# fs-enhance

> extend file system apis for some more complex operation

Latest version **1.0.3** (published 2015-02-09) · https://github.com/lujintan/fs-enhance/blob/master/LICENSE license · 0 weekly downloads

## Install

```sh
npm install fs-enhance
pnpm add fs-enhance
yarn add fs-enhance
bun add fs-enhance
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2015-02-09 |
| First published | 2015-02-09 |
| Weekly downloads | 0 |
| License | https://github.com/lujintan/fs-enhance/blob/master/LICENSE |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lujintan |
| Maintainers | yingxuetan |
| Keywords | fileapi, copyfile, readfolder |

## Links

- npm: https://www.npmjs.com/package/fs-enhance
- Repository: https://github.com/lujintan/fs-enhance
- Issues: https://github.com/lujintan/fs-enhance/issues
- npm.io page: https://npm.io/package/fs-enhance

## Recent versions

- 1.0.3 (latest) — 2015-02-09
- 1.0.2 — 2015-02-09
- 1.0.1 — 2015-02-09
- 1.0.0 — 2015-02-09

## README

# fs-enhance
extend file system apis for some more complex operation, [more info](http://www.kkyfj.com/opensource/fs-enhance)

###Installation

```base
npm install -g fs-enhance
```

###API

####fsEnhance.copyFile
copy file

######parameter:

* `src`: `String` source file path
* `target`: `String` target file path
* `cb`: `Function` the callback for error occur

######example:

```javascript
var fsEnhance = require('fs-enhance');

fsEnhance.copyFile('aaa.js', 'bbb.js', function(err) {
    if (err){
        throw new Error('Error: copy file aaa.js error');
    }
});
```

####fsEnhance.mkdir
create folders in folder path, is similar to mkdir -p aaa/bbb/ccc

######parameter:

* `dirpath`: `String` source folder path
* `mode`: `String|Number` folder's file mode, mode defaults to 0777

######example:

```javascript
var fsEnhance = require('fs-enhance');

fsEnhance.mkdir('aaa/bbb/ccc');
```

####fsEnhance.readDir
traversal folder then excute the callback

######parameter:

* `src`: `String` source file path
* `cb`: `Function` the callback for each file or folder
```javascript
//cb's arguments
{
    path: filePath,   //file's real path
    type: 1|0    //file's type 1: file  0: folder
}
```

######example:

```javascript
var fsEnhance = require('fs-enhance');

fsEnhance.readDir('./test', function(fileInfo){
    console.log(fileInfo.path);
    if (fileInfo.type === 1) {
        //file ...
    } else if (fileInfo.type === 0) {
        //folder ...
    }
});
```

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