1.0.1 • Published 2 years ago

packagephobia v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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
}

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.

1.0.1

2 years ago

1.0.0

2 years ago