Fetch package metadata from the npm registry with a simple, promise-based API.
package-json is a Node.js library that fetches metadata for packages from the npm registry. It provides a simple, promise-based API to retrieve information such as versions, dependencies, and other package details, solving the need for programmatic access to npm data without manual HTTP requests.
Node.js developers building tools that interact with the npm ecosystem, such as dependency analyzers, version checkers, CLI utilities, or CI/CD pipelines.
Developers choose package-json for its reliability, seamless integration with npm defaults, and straightforward API that handles complexities like scoped packages, semver ranges, and private registries automatically.
Get metadata of a package from the npm registry
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Offers a single function call to fetch package metadata, supporting both regular and scoped packages without complex configuration, as shown in the basic usage example.
Allows specifying versions using semver ranges, dist tags, or exact versions, making it versatile for tools that need precise version data, as documented in the API options.
Infers registry settings from .npmrc and npm defaults, ensuring consistency with the npm CLI and seamless work with private registries without manual setup.
Returns abbreviated metadata by default for faster responses, with a 'fullMetadata' option for detailed info, balancing speed and completeness based on needs.
The library does not implement proxy support, requiring users to rely on global agents or additional configuration for proxy environments, as admitted in the README.
Designed specifically for the npm registry, so it cannot fetch metadata from other package managers like Yarn or pnpm directly, limiting its use in mixed ecosystems.
Uses the fetch API internally, which may not be available in older Node.js versions without polyfills, potentially adding complexity for legacy environments.