npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

file-hash-calculator

v0.0.3

Published

一个文件hash计算器

Readme

file-hash-calculator

[toc]

#简介 该项目简单实现了多进程计算目录中文件的hash值 ##修改记录 0.0.3

  1. 新增参数 fileOpenLimit 控制进程打开文件数量
  2. 修改调用参数列表,详见使用方法@0.0.3
  3. 新增参数 algorithm 控制计算hash的算法,默认: sha1, 支持: md5, sha256等

##使用方法@0.0.3

  1. 安装

    npm install [email protected] --save
  2. 使用

    • 示例
    	const fhc = require('file-hash-calculator');
    	fhc(srcPath, {algorithm: 'md5'}, outputItemFormatter)
    		.then(results=>{
    			console.log(results);
    		});

    输入

    • 参数说明:

    | 字段名 | 类型 | 必须 |说明| | ------------- |:-------|:---------|:----| | 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 {Object} 单个文件的信息
     * @returns {string} 返回单行路径,hash值,文件长度
     */
    function defaultOutPutItemFormatter(item) {
        return `${item.path},${item.hash},${item.size}\n`;
    }

    输出

    • {Promise} 返回promise对象,resolve the results。

##使用方法@0.0.2

  1. 安装

    npm install [email protected] --save
  2. 使用

    	const fhc = require('file-hash-calculator');
    	fhc(srcPath, excludes, outputFilePath, outputItemFormatter)
    		.then(results=>{
    			console.log(results);
    		});

    输入

    • 参数说明:

    | 字段名 | 类型 | 必须 |说明| | ------------- |:-------|:---------|:----| | srcPath | {String} |required|源路径,要处理的文件路径| | excludes | {String,Array}| optional| 排除的文件 | | outputFilePath | {String} |optional |生成的输出文件| | outputItemFormatter | {Function}| optional|每一个文件计算后输出格式化函数 |

    • outputItemFormatter:
    /**
     * 默认的格式化单个文件信息的内容
     * @param item {Object} 单个文件的信息
     * @returns {string} 返回单行路径,hash值,文件长度
     */
    function defaultOutPutItemFormatter(item) {
        return `${item.path},${item.hash},${item.size}\n`;
    }

    输出

    • {Promise} 返回promise对象,resolve the results。