file-info
Version:
Traverse the current directory and display the file information.
48 lines (35 loc) • 1.52 kB
Markdown
# file-info
[](https://www.npmjs.com/package/file-info) [](https://github.com/Niefee/file-info/blob/master/LICENSE) [](https://travis-ci.org/Niefee/file-info)
Traverse the current directory and display the file information
## 使用
npm安装
```bash
npm i --save file-info
```
在Node.js中使用
```js
//引入模块
const fileInfo=require('file-info');
/**
* 获取文件夹目录数组
* @param {String} [use_path=''] 文件夹路径
* @param {Array} [ignoreArr=[]] 忽略的文件夹
* @param {Boolean} [isIgnore=true] 是否忽略默认文件夹,默认为true
* @return {Array} 返回一个Promise对象,回调函数参数为文件夹数组
*/
fileInfo.showList('./directory-path').then((data)=>{
console.log(data);
});
/**
* 获取文件夹详细信息
* @param {String} [use_path=''] 文件夹路径
* @param {Array} [ignoreArr=[]] 忽略的文件数组
* @param {Boolean} [isIgnore=true] 是否忽略默认文件夹
* @return {Array} 返回一个Promise对象,回调函数参数为数组,包括所有文件总行数、总中文字数、总英文字数、总标点符号数以及文件总大小(totalLine、chineseNum、endlishNum、sizeNum)
*/
info.showDetail('./directory-path').then((data)=>{
console.log(data);
});
```
## LICENSE
[MIT License](LICENSE)