packagephobia
v1.0.1
Published
> API wrapper for [Package Phobia](https://github.com/styfle/packagephobia): get the publish and install size from any package in the [NPM registry](https://www.npmjs.com).
Downloads
17
Maintainers
Readme
packagephobia (API)
API wrapper for Package Phobia: get the publish and install size from any package in the NPM registry.
Features
- Written using TypeScript (and thus fully typed, supporting TypeScript and JavaScript).
- Lightweight.
- Supports ESM and CJS.
Installation
# npm
npm i packagephobia
# yarn
yarn add packagephobia
Usage
import packagephobia from 'packagephobia'
const data = await packagephobia( 'undici' )
{
name: 'undici',
version: '4.14.1',
publish: { bytes: 792635, files: 109, pretty: '774 kB', color: '#97CA00' },
install: { bytes: 792635, files: 109, pretty: '774 kB', color: '#97CA00' }
}
Notes
- By default, it uses API v2. To use API v1, pass a second parameter to the function with the number.
import packagephobia from 'packagephobia'
const data = await packagephobia( 'undici', 1 )
{
installSize: 792635,
publishSize: 792635
}
- For more information about Package Phobia, check its repository.
Why?
This package is typed, so you can be sure about the available properties in the response.
Alternatives
Run your favorite requests package (node-fetch
, request
, undici
) and make the request yourself.