# bytesize

> ##Installation

Latest version **1.1.0** (published 2018-01-08) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-01-08 |
| First published | 2013-04-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | First and Third |
| Maintainers | jga, aleperez92, alaguna, orthagonal1, ecwillis, dawnerd |

## Links

- npm: https://www.npmjs.com/package/bytesize
- Repository: https://github.com/firstandthird/bytesize
- Homepage: https://github.com/firstandthird/bytesize#readme
- Issues: https://github.com/firstandthird/bytesize/issues
- npm.io page: https://npm.io/package/bytesize

## Dependencies (1)

- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^4.0.2

## Recent versions

- 1.1.0 (latest) — 2018-01-08
- 1.0.0 — 2018-01-07
- 0.2.0 — 2013-05-02
- 0.1.0 — 2013-04-25

## README

#bytesize

##Installation

`npm install bytesize`

##Usage

```javascript
const bytesize = require('bytesize');

//string size
const size = bytesize.stringSize('1 12 3 123 123');
//size == 14

//string size
const size = bytesize.stringSize('1 12 3 123 123', true);
//size == 14B

//file size (returns a Promise that you can await)
try {
  const size = await bytesize.fileSize(__dirname + '/fixtures/test.txt');
  //size == 6660
} catch(exc) {
  console.log(exc);
}

//pretty file size
try {
  const size = await bytesize.fileSize(__dirname + '/fixtures/test.txt', true);
  //size == '6.50KB'
} catch(exc) {
  console.log(exc);
}

//gzip file size
try{
  const size = await bytesize.gzipSize(__dirname + '/fixtures/test.txt');
  //size == 190
} catch(exc) {
  console.log(exc);
}

//pretty gzip file size
const size = await bytesize.gzipSize(__dirname + '/fixtures/test.txt', true);
//size == '190B'
```

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