1. maxmin
Get a pretty output of the original, minified, gzipped size of a string or buffer: 130 B → 91 B → 53 B (gzip)
maxmin
Package: maxmin
Created by: sindresorhus
Last modified: Sun, 19 Jun 2022 17:00:37 GMT
Version: 4.0.0
License: MIT
Downloads: 2,139,067
Repository: https://github.com/sindresorhus/maxmin

Install

npm install maxmin
yarn add maxmin

maxmin

Get a pretty output of the original, minified, gzipped size of a string or buffer

Useful for logging the difference between original and minified file in, for example, a build-system.

Install

$ npm install maxmin

Usage

 import maxmin from 'maxmin';

const max = 'function smoothRangeRandom(min,max){var num=Math.floor(Math.random()*(max-min+1)+min);return this.prev=num===this.prev?++num:num};';

const min = '(function(b,c){var a=Math.floor(Math.random()*(c-b+1)+b);return this.a=a===this.a?++a:a})()';

console.log(maxmin(max, min, true));
//=> '130 B → 91 B → 53 B (gzip)'

API

maxmin(max, min, useGzip?)

max

Type: string | Buffer | number

Original string or its size in bytes.

min

Type: string | Buffer | number

Minified string or its size in bytes.

useGzip

Type: boolean
Default: false

Show gzipped size of min. Pretty slow. Not shown when min is a number.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code