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

@eqshow/get-pkg-info

v1.0.5

Published

获取包相关信息

Downloads

5

Readme

@eqshow/get-pkg-info

TODO: 查询npm包的信息。

使用说明

const getPkgInfoUtils = require('@eqshow/get-pkg-info');

// TODO: DEMONSTRATE API

getPkgInfo

获取包相关信息。

const { getPkgInfo } = require('@eqshow/get-pkg-info');
getPkgInfo(packageName, registry)

接收两个参数。第一个参数为npm包的名称。第二个参数为使用的源地址,默认不写使用npm源。返回一个对象。

getDefaultRegistry

获取默认registry。

const { getDefaultRegistry } = require('@eqshow/get-pkg-info');
getDefaultRegistry(false)

接收一个boolean参数,默认为false。当为 true 时,返回的是npm 源地址。当为 false 时,返回的是 taobao 源地址。

getPkgVersions

获取包的所有版本。

const { getPkgVersions } = require('@eqshow/get-pkg-info');
getPkgVersions(pkgName, registry)

接收两个参数。第一个参数为npm包的名称。第二个参数为使用的源地址,默认使用npm源。返回一个数组。

getPkgSemverVersions

获取当前主版本号下,大于当前版本的所有版本。

const { getPkgSemverVersions } = require('@eqshow/get-pkg-info');
getPkgSemverVersions(pkgName, pkgVersion, registry)

接收三个参数。第一个参数为npm包的名称。第二个参数为npm包的版本号。第三个参数为使用的源地址,默认使用npm源。返回一个数组。

getPkgSemverVersion

获取当前主版本号下,最新的版本号。

const { getPkgSemverVersion } = require('@eqshow/get-pkg-info');
getPkgSemverVersion(pkgName, pkgVersion, registry)

接收三个参数。第一个参数为npm包的名称。第二个参数为npm包的版本号。第三个参数为使用的源地址,默认使用npm源。返回一个数组。

getPkgLatestVersion

获取最新稳定版本。

const { getPkgLatestVersion } = require('@eqshow/get-pkg-info');
getPkgLatestVersion(pkgName, registry)

接收两个参数。第一个参数为npm包的名称,第二个参数为使用的源地址,默认使用npm源。返回一个版本号字符串。