# b64-lite

> isomorphic base64 library in 152 bytes

Latest version **1.4.0** (published 2019-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install b64-lite
pnpm add b64-lite
yarn add b64-lite
bun add b64-lite
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2019-09-17 |
| First published | 2017-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/b64-lite) |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | kevlened |
| Keywords | b64, isomorphic, small, atob, btoa |

## Links

- npm: https://www.npmjs.com/package/b64-lite
- Repository: https://github.com/kevlened/b64-lite
- Homepage: https://github.com/kevlened/b64-lite#readme
- Issues: https://github.com/kevlened/b64-lite/issues
- npm.io page: https://npm.io/package/b64-lite

## Dependencies (1)

- [base-64](https://npm.io/package/base-64.md) ^0.1.0

## Recent versions

- 1.4.0 (latest) — 2019-09-17
- 1.3.1 — 2018-02-03
- 1.3.0 — 2018-01-31
- 1.2.0 — 2018-01-08
- 1.1.1 — 2018-01-07
- 1.1.0 — 2018-01-07
- 1.0.1 — 2018-01-06
- 1.0.0 — 2018-01-06
- 0.0.1 — 2017-12-11

## README

# b64-lite [![NPM](https://img.shields.io/npm/v/b64-lite.svg)](https://npmjs.com/package/b64-lite) [![Build](https://travis-ci.org/kevlened/b64-lite.svg?branch=master)](https://travis-ci.org/kevlened/b64-lite) [![bundlephobia](https://img.shields.io/bundlephobia/minzip/b64-lite.svg)](https://bundlephobia.com/result?p=b64-lite)

Node, browser, and React Native base64 library

## Usage

```javascript
const b64 = require('b64-lite');

// Base64 in ASCII to byte string
b64.atob('aGkgdGhlcmU=');
// hi there

// byte string to Base64 in ASCII
b64.btoa('hi there');
// aGkgdGhlcmU=

// convert unicode to b64
b64.toBase64('hello 你好');
// aGVsbG8g5L2g5aW9

// convert a buffer to b64
b64.toBase64(new Uint8Array([228, 189, 160, 229, 165, 189]).buffer);
// 5L2g5aW9

// decode b64 to unicode
b64.fromBase64('aGVsbG8g5L2g5aW9');
// hello 你好

// convert b64 to a buffer
b64.toBuffer('5L2g5aW9');
// new Uint8Array([228, 189, 160, 229, 165, 189]).buffer
```

## Can it be smaller?

If you use ES6 imports with a bundler that supports tree-shaking, yes!

```javascript
import { toBase64 } from 'b64-lite'
```

## License

MIT

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