skiano / disty

Pretty-print dist file sizes with only bare minimum of dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

disty

Pretty-print dist file sizes with minimal dependencies.

why

With npm audits and increasingly huge dev tools, I wanted a solution for this that requires very few other tools.

It installs and boots fast and makes me happy :)

dependencies

Package What Why
bytes zero-dependency human readible file sizes improves api for input/output
text-table zero-dependency ascii tablualar data better printing for output

Installation

$ npm i disty

Use in package.json

{
  "scripts": {
    "size": "disty --path dist"
  }
}

Node API

const { printFileStats } = require('disty');

printFileStats('path/to/directory', [options]); // prints to console and returns promise

OPTIONS

  • filter: function given a file path, returns true if it should be included
  • sort: function given two file objects that sorts them
  • maxDepth: how many folders deep should it continue (0 is top level only)
  • checkGzip: also estimate gzip size (true by default)
  • bytesOptions: formatting options passed to bytes

About

Pretty-print dist file sizes with only bare minimum of dependencies

License:MIT License


Languages

Language:JavaScript 100.0%