# react-pretty-bytes

> Convert bytes to a human readable string

Latest version **1.0.3** (published 2020-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-pretty-bytes
pnpm add react-pretty-bytes
yarn add react-pretty-bytes
bun add react-pretty-bytes
```

## 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.0.3 |
| Published | 2020-03-27 |
| First published | 2020-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 17.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Yohix |
| Maintainers | yohix |
| Keywords | yohix, react, react native, humanizer, humanize bytes, pretty bytes |

## Links

- npm: https://www.npmjs.com/package/react-pretty-bytes
- Repository: https://github.com/yohix/react-pretty-bytes
- Issues: https://github.com/yohix/react-pretty-bytes/issues
- npm.io page: https://npm.io/package/react-pretty-bytes

## Dependencies (1)

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

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-03-27
- 1.0.2 — 2020-03-24
- 1.0.1 — 2020-03-23
- 1.0.0 — 2020-03-23

## README

# React Pretty Bytes

> Convert bytes to a human readable string `1337` → `1.34 kB`

[![CI](https://github.com/yohix/react-pretty-bytes/workflows/CI/badge.svg)](https://github.com/yohix/react-pretty-bytes/actions)
[![Version](http://img.shields.io/npm/v/react-pretty-bytes.svg?style=flat)](https://badge.fury.io/js/react-pretty-bytes)
[![Downloads](https://img.shields.io/npm/dm/react-pretty-bytes.svg)](https://npmjs.com/react-pretty-bytes)
[![Install size](https://badgen.net/packagephobia/install/react-pretty-bytes)](https://packagephobia.now.sh/result?p=react-pretty-bytes)

[![NPM](https://nodei.co/npm/react-pretty-bytes.png?downloads=true)](https://nodei.co/npm/react-pretty-bytes)

## Try in CodeSandbox

[![Edit react-camelcase](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/react-pretty-bytes-ypfx8?fontsize=14&hidenavigation=1&theme=dark)

## Install

```
$ npm install react-pretty-bytes
```

## Usage

```js
import PrettyBytes from 'react-pretty-bytes';

const App = () => (
  <div>
    <PrettyBytes bytes={1337} />
  </div>
);

// => '1.34 kB'
```

## API

### bytes={input}

Type: `integer`

```jsx
<PrettyBytes bytes={1337} />

// => '1.34 kB'
```

### option={object}

Type: `object`

#### `{bits: true}`

Type: `boolean`
Default: `false`

```jsx
<PrettyBytes bytes={1337} option={{bits: true}} />

// => '1.34 kbit'
```

#### `{signed: true}`

Type: `boolean`
Default: `false`

```jsx
<PrettyBytes bytes={1337} option={{signed: true}} />

// => '+42 B'
```

#### `{locale: 'lang'}`

Type: `boolean` `string`
Default: `false`

```jsx
<PrettyBytes bytes={1337} option={{locale: 'de'}} />

// => '1,34 kB'
```

## Modules used

- [**pretty-bytes**](https://www.npmjs.com/package/pretty-bytes) - Convert bytes to a human readable string

## License

MIT © [Yohix](LICENSE)

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