file-hash-calculator
[toc]
简介
该项目简单实现了多进程计算目录中文件的hash值
修改记录
0.0.3
- 新增参数
fileOpenLimit
控制进程打开文件数量- 修改调用参数列表,详见使用方法@0.0.3
- 新增参数
algorithm
控制计算hash的算法,默认: sha1, 支持: md5, sha256等
使用方法@0.0.3
-
安装
npm install file-hash-calculator@0.0.3 --save
-
使用
- 示例
const fhc = ;;输入
- 参数说明:
| 字段名 | 类型 | 必须 |说明| | ------------- |:-------|:---------|:----| | srcPath | {String} |required|源路径,要处理的文件路径| | options | {Object}| optional| 可选参数,调用配置项 | | outputItemFormatter | {Function}| optional|每一个文件计算后输出格式化函数 |
- options数据格式说明
{ excludes: {String|Array} 排除的文件 outputFilePath: {String} 结果输出的文件路径 algorithm: {String} hash算法名,默认: "sha1", 可选: "sha256","md5"... fileOpenLimit: {Number} 单进程能打开的最大文件数 }
- outputItemFormatter:
/*** 默认的格式化单个文件信息的内容* @param item* @returns*/{return `,,\n`;}输出
- {Promise} 返回promise对象,resolve the results。
使用方法@0.0.2
-
安装
npm install file-hash-calculator@0.0.2 --save
-
使用
const fhc = ;;输入
- 参数说明:
| 字段名 | 类型 | 必须 |说明| | ------------- |:-------|:---------|:----| | srcPath | {String} |required|源路径,要处理的文件路径| | excludes | {String,Array}| optional| 排除的文件 | | outputFilePath | {String} |optional |生成的输出文件| | outputItemFormatter | {Function}| optional|每一个文件计算后输出格式化函数 |
- outputItemFormatter:
/*** 默认的格式化单个文件信息的内容* @param item* @returns*/{return `,,\n`;}输出
- {Promise} 返回promise对象,resolve the results。