# base64-js

> Base64 encoding/decoding in pure JS

Latest version **1.5.1** (published 2020-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install base64-js
pnpm add base64-js
yarn add base64-js
bun add base64-js
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2020-11-11 |
| First published | 2011-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 881 |
| Author | T. Jameson Little |
| Maintainers | beatgammit, feross |
| Keywords | base64 |

## Links

- npm: https://www.npmjs.com/package/base64-js
- Repository: https://github.com/beatgammit/base64-js
- Issues: https://github.com/beatgammit/base64-js/issues
- Funding: https://github.com/sponsors/feross
- npm.io page: https://npm.io/package/base64-js

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.5.1 (latest) — 2020-11-11
- 1.5.0 — 2020-11-11
- 1.3.1 — 2019-08-06
- 1.3.0 — 2018-04-17
- 1.2.3 — 2018-02-16
- 1.2.2 — 2018-02-16
- 1.2.1 — 2017-06-22
- 1.2.0 — 2016-09-22
- 1.1.2 — 2016-03-24
- 1.1.1 — 2016-03-02
- 1.1.0 — 2016-02-29
- 1.0.4 — 2016-02-13
- 1.0.3 — 2016-02-12
- 1.0.2 — 2016-01-09
- 1.0.1 — 2016-01-05
- … 8 more at https://npm.io/package/base64-js/versions

## README

base64-js
=========

`base64-js` does basic base64 encoding/decoding in pure JS.

[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js)

Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.

Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.

## install

With [npm](https://npmjs.org) do:

`npm install base64-js` and `var base64js = require('base64-js')`

For use in web browsers do:

`<script src="base64js.min.js"></script>`

[Get supported base64-js with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-base64-js?utm_source=npm-base64-js&utm_medium=referral&utm_campaign=readme)

## methods

`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.

* `byteLength` - Takes a base64 string and returns length of byte array
* `toByteArray` - Takes a base64 string and returns a byte array
* `fromByteArray` - Takes a byte array and returns a base64 string

## license

MIT

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