Check the published install size of any NPM package before installing it, or the actual installed size after install with --installed
.
- Fetches and extracts the latest or specific version of any npm package
- Calculates and displays the total uncompressed install size
- Supports multiple packages at once
- Human-readable, JSON, CSV, and Markdown output modes
- Summarize mode: shows file count, largest file, and estimated download time
-
Scoped package support (e.g.
@babel/core
) -
Dependency tree size with
--deps
- Minified & gzipped size estimation
- Top N largest files and file type breakdown
- Compare mode for side-by-side stats
- Historical size tracking for previous versions
- Badge generation for README
- Interactive mode for easy CLI use
- Output to file in any format
- Custom download speed for time estimation
- Progress bar for multi-package checks
-
Config file support (
.npm-install-sizerc
) - Programmatic API for Node.js scripts
- No install required (run with npx)
npx npm-install-size react express lodash
Output:
📦 react@19.1.0: 167 kB
📦 express@5.1.0: 197 kB
📦 lodash@4.17.21: 1.41 MB
npx npm-install-size ./packages/my-lib
Output:
📦 ./packages/my-lib@1.0.0: 42 kB
npx npm-install-size --workspace my-lib
Note: Workspace support requires your root package.json to define
workspaces
.
npx npm-install-size react@18.2.0
Output:
📦 react@18.2.0: 316 kB
npx npm-install-size express --deps
npx npm-install-size react --minified --gzipped
npx npm-install-size react --top 5
npx npm-install-size react --types
npx npm-install-size react vue --compare
npx npm-install-size react --history 5
npx npm-install-size react --badge
npx npm-install-size --interactive
npx npm-install-size react --json --output result.json
npx npm-install-size react --speed 2
npx npm-install-size --installed
Output:
⚠️ This is the actual installed size on disk, including all dependencies. It may be much larger than the published tarball size.
📦 node_modules: 132 MB
npx npm-install-size --installed express
Output:
⚠️ This is the actual installed size on disk, including all dependencies. It may be much larger than the published tarball size.
📦 node_modules/express: 1.2 MB
You can set default options in a .npm-install-sizerc
file (JSON) in your project root:
{
"packages": ["react", "express"],
"json": true,
"summarize": true,
"topN": 5,
"output": "sizes.json"
}
- CLI arguments always override config defaults.
- If you run the CLI with no arguments, the config is used.
You can use npm-install-size
as a library in your Node.js ESM projects:
import {
getInstallSize,
getDependencyTreeSize,
getMinifiedAndGzippedSize,
getFileTypeBreakdown
} from 'npm-install-size';
const info = await getInstallSize('react');
console.log(info);
const tree = await getDependencyTreeSize('react');
console.log(tree);
const minified = await getMinifiedAndGzippedSize('react');
console.log(minified);
const types = await getFileTypeBreakdown('react');
console.log(types);
- Pass one or more package names (optionally with versions, e.g.
react@18.2.0
) -
--json
— Output results as JSON -
--csv
— Output results as CSV -
--md
— Output results as Markdown table -
--summarize
— Show file count, largest file, and download time -
--deps
— Show total size including all dependencies -
--minified
— Estimate minified size -
--gzipped
— Estimate gzipped size -
--top N
— Show top N largest files -
--types
— Show file type breakdown -
--compare
— Compare multiple packages side-by-side -
--history N
— Show install size for last N versions -
--badge
— Output a Markdown badge for README -
--interactive
— Use interactive prompts -
--output <file>
— Write output to a file -
--speed <mbps>
— Set custom download speed for time estimation -
--installed
— Show the actual installed size of node_modules or a specific package (includes all dependencies; may be much larger than the published tarball size)
Q: Does it support monorepos or workspaces?
A: Yes! You can analyze local package directories or workspace packages. Use a local path (e.g. ./packages/foo
) or --workspace <name>
. Dependency tree analysis (--deps
) is only supported for published packages.
MIT