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 🙏

© 2024 – Pkg Stats / Ryan Hefner

md5-util

v1.0.1

Published

拓展spark-md5,支持计算网络文件md5的小插件

Downloads

9

Readme

md5-util npm

拓展spark-md5,支持计算网络文件md5的小插件。

安装

npm install md5-util --save

使用方式

计算本地文件md5

SparkMD5.file(file,function(md5){
  //如果文件读取失败,md5为null
  console.log(md5)
})

计算网络文件md5

/*
 使用了XMLHttpRequest responseType = 'blob',在部分浏览器存在兼容性问题,
 已知ios uc浏览器及安卓5.1.1系统浏览器中返回blob不正确,导致md5计算错误,
 如果要计算网络文件请慎用,或者计算已知md5的网络文件,对比md5是否准确,考量使用。
*/

SparkMD5.file(url,function(md5){
  //网络请求失败、文件读取失败等,md5为null
  console.log(md5)
})

//提前验证md5
var rightMd5 = '2b07d9a0a5f3918d876f5acfb8416401';
SparkMD5.file('https://weijhfly.github.io/favicon.ico',function(md5){
  if(md5 && md5 !== rightMd5){
    console.log('md5计算错误,请停止使用');
  }
})

SparkMD5官方示例

SparkMD5.hash('hello world')
//"5eb63bbbe01eeed093cb22bb8f5acdc3"

更多官方示例查看SparkMD5

演示

md5-util(下方直接扫码即可体验)

rolldate

浏览器兼容性

除了计算网络文件md5外,兼容性与SparkMD5一致,关于计算网络文件md5兼容性问题,请参考上面:使用方式>计算网络文件md5

License

MIT