@pvtnbr/pkg-size
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published






Measure the size of your npm package distribution

⚡️ Try it in your npm package

$ npx @pvtnbr/pkg-size

If you like this project, please star it & follow me to see what other cool projects I'm working on! ❤️

🙋‍♂️ Why?

  • 🔍 Size analysis Quickly determine the total size of what you're publishing to npm!
  • 🔥 Same behavior as npm pack/publish Collects publish files as specified in your package.json!
  • 🙌 Gzip & Brotli See how your files compress in addition to normal size!
  • 🤖 Node.js API Integrate size checks to your CI via Node.js API

🚀 Install

npm i @pvtnbr/pkg-size

🚦 Quick Usage

const pkgSize = require('@pvtnbr/pkg-size');

// Get package size data from current working directory
const sizeData = await pkgSize();

// Get package size data from a specific package path
const sizeData = await pkgSize('/path/to/package');

⚙️ API

type FileEntry = {
    path: string;
    mode: number;
    size: number;
    sizeGzip: number;
    sizeBrotli: number;
};

type PkgSizeData = {
    pkgPath: string;
    tarballSize: number;
    files: FileEntry[];
};

function pkgSize(pkgPath?: string): Promise<PkgSizeData>;

Package Sidebar

Install

npm i @pvtnbr/pkg-size

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

8.59 kB

Total Files

6

Last publish

Collaborators

  • hirokiosame