Pretty-print dist file sizes with minimal dependencies.
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 :)
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 |
$ npm i disty
{
"scripts": {
"size": "disty --path dist"
}
}
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 includedsort
: function given two file objects that sorts themmaxDepth
: how many folders deep should it continue (0 is top level only)checkGzip
: also estimate gzip size (true by default)bytesOptions
: formatting options passed tobytes