# fileutil

> an easy file operation utility

Latest version **1.1.1** (published 2013-05-03) · 0 weekly downloads

## Install

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

## 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.1.1 |
| Published | 2013-05-03 |
| First published | 2012-12-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | colorhook |
| Maintainers | colorhook |
| Keywords | synchronous file operation, touch, move, mkdir, copy |

## Links

- npm: https://www.npmjs.com/package/fileutil
- Repository: https://github.com/colorhook/fileutil
- Issues: http://github.com/colorhook/fileutil/issues
- npm.io page: https://npm.io/package/fileutil

## Dependencies (1)

- [wrench](https://npm.io/package/wrench.md) ~1.4.4

## Recent versions

- 1.1.1 (latest) — 2013-05-03
- 1.1.0 — 2013-01-10
- 1.0.0 — 2012-12-06

## README

fileutil
=====

目标
-------
简易的文件操作API

安装
-------
npm install fileutil

示例
-------

```javascript
var fu = require('fileutil');

//创建文件
fu.touch('/var/www/log/2012-12-6.log');

//创建文件夹
fu.mkdir('/usr/local/tmp/node-example');

//删除文件或文件夹
fu.delete('/var/www/tmp');

//是否存在
fu.exist(file); 

//复制文件或者文件夹里的所有文件到某个新目录
fu.copy(file, 'new-path'); 

//移动文件或者文件夹里的所有文件到某个新目录
fu.move(file, 'new-path'); 

//重命名
fu.rename(file, 'new-name');

//列出文件夹里的所有文件和文件夹
var files = fu.list(src);

//根据过滤参数，列出文件夹里的所有文件和文件夹
var files = fu.list(src, {
  excludeDirectory: true, //不包含文件夹
  excludeFile: false, //包含文件
  matchFunction: function(item){
    return item.name.match(reg);
  }
});

//回调的方式遍历文件
fu.each(src, function(item){
  console.log(item.filename); //文件名
  console.log(item.name); //路径
  console.log(item.directory); //是否是文件夹
});

//异步回调的方式遍历文件
fu.each(src, function(item){
  console.log(item);
}, {
  sync: false, //异步
  matchFunction: function(item){
    return item.name.match(reg);
  }
}, function(){
  console.log('遍历完成');
});
```


Licence
---------

`fileutil` is free to use under MIT license. 

Bugs & Feedback
----------

Please feel free to [report bugs](http://github.com/colorhook/fileutil/issues) or [feature requests](http://github.com/colorhook/fileutil/pulls).
You can send me private message on `github`, or send me an email to: [colorhook@gmail.com]

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