# b64u-lite

> isomorphic base64url library in 358 bytes

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

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-09-17 |
| First published | 2018-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | kevlened |
| Keywords | isomorphic, base64url, b64u, react, native |

## Links

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

## Dependencies (1)

- [b64-lite](https://npm.io/package/b64-lite.md) ^1.4.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.1.0 (latest) — 2019-09-17
- 1.0.1 — 2018-01-08
- 1.0.0 — 2018-01-08
- 0.0.2 — 2018-01-07

## README

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

isomorphic base64url library in 244 bytes

## Usage

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

b64u.toBase64Url('hi there? 你好');
// aGkgdGhlcmU_IOS9oOWlvQ

// add padding
b64u.toBase64Url('hi there? 你好', true);
// aGkgdGhlcmU_IOS9oOWlvQ==

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

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

// works with or without padding
b64u.fromBase64Url('aGkgdGhlcmU_IOS9oOWlvQ==');
b64u.fromBase64Url('aGkgdGhlcmU_IOS9oOWlvQ');
// hi there? 你好

// equivalent to btoa
b64u.fromBinaryString('hi there? ');
// aGkgdGhlcmU_IA

// with padding
b64u.fromBinaryString('hi there? ', true);
// aGkgdGhlcmU_IA==

// equivalent to atob
b64u.toBinaryString('aGkgdGhlcmU=');
// hi there?
```

## Can it be smaller?

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

```javascript
import { toBase64Url } from 'b64u-lite'
```

## License

MIT

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