# maxmin

> Get a pretty output of the original, minified, gzipped size of a string or buffer: 130 B → 91 B → 53 B (gzip)

Latest version **4.1.0** (published 2024-06-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install maxmin
pnpm add maxmin
yarn add maxmin
bun add maxmin
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2024-06-04 |
| First published | 2014-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 4 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | string, buffer, pretty, color, gzip, minified, min, max, diff, difference |

## Links

- npm: https://www.npmjs.com/package/maxmin
- Repository: https://github.com/sindresorhus/maxmin
- Homepage: https://github.com/sindresorhus/maxmin#readme
- Issues: https://github.com/sindresorhus/maxmin/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/maxmin

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^4.1.1
- [figures](https://npm.io/package/figures.md) ^3.2.0
- [gzip-size](https://npm.io/package/gzip-size.md) ^6.0.0
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^5.6.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 4.1.0 (latest) — 2024-06-04
- 4.0.0 — 2021-05-03
- 3.0.0 — 2020-07-03
- 2.1.0 — 2015-12-23
- 2.0.0 — 2015-11-14
- 1.1.0 — 2015-03-29
- 1.0.1 — 2015-02-24
- 1.0.0 — 2014-08-09
- 0.2.2 — 2014-07-10
- 0.2.1 — 2014-07-04
- 0.2.0 — 2014-04-18
- 0.1.0 — 2014-02-28

## README

# maxmin

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

![](screenshot.png)

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

## Install

```sh
npm install maxmin
```

## Usage

```js
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`.

---
_Source: https://npm.io/package/maxmin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
