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 🙏

© 2026 – Pkg Stats / Ryan Hefner

url-md5

v0.1.3

Published

> URL MD5 是一个将 url 中的路径和查询参数使用 md5 加密的工具。

Readme

URL MD5

URL MD5 是一个将 url 中的路径和查询参数使用 md5 加密的工具。

使用指南

使用条件

该项目需要在 node 环境下使用。

安装

npm install url-md5

使用示例

import urlMd5 from "url-md5";

// 传入完整 url
urlMd5.encode("https://www.hostname.com/pathname?a=1&b=2");

// 仅传入 pathname 和 search,适用于 axios 一类使用 basichURL 
urlMd5.encode("/pathname?a=1&b=2");

// 还可以直接传入请求 options
urlMd5.encode({url: "/pathname", method: "POST", params: {a: 1, b: 2}});

详细说明

urlMd5.encode([url,pathname+querystring,options])

encode 函数会将传入的参数格式化成标准的 url 然后截取 pathname+search 进行 md5 加密。

自定义配置

urlMd5.config.salt

你可以定义配置 salt,md5 加密时会将 salt 拼接到 pathname+search 之后。

import urlMd5 from "url-md5";

// 设置 salt
urlMd5.config.salt = "Your salt";

// 示例
urlMd5.encode("https:/www.hostname.com/pathname?a=1&b=2"); // => md5("/pathname?a=1&b=2" + "Your salt");

urlMd5.encode("/pathname?a=1&b=2"); // => md5("/pathname?a=1&b=2" + "Your salt");

urlMd5.encode({url: "/pathname", params: {a: 1, b: 2}}); // => md5("/pathname?a=1&b=2" + "Your salt");

urlMd5.config.pathRewriter(pathname, raw)

如在使用 axios 时,你需要替换加密的 pathname 则可以自定义该函数。

import urlMd5 from "url-md5";

// 设置 pathRewriter
urlMd5.config.pathRewriter = function (pathname, raw) {
    return pathname.replace("/prefix", "") // 将 /prefix/pathname 替换为 /pathname
}

// 示例
urlMd5.encode("https://www.hostname.com/prefix/pathname?a=1&b=2") // => md5("/pathname/?a=1&b=2");

urlMd5.encode("/prefix/pathname?a=1&b=2") // => md5("/pathname/?a=1&b=2");

urlMd5.encode({url: "/prefix/pathname", params: {a: 1, b: 2}}) // => md5("/pathname/?a=1&b=2");