# base64-transcoder

> Base64 transcoding in pure JS

Latest version **1.1.1** (published 2022-05-04) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2022-05-04 |
| First published | 2020-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | jesse.tane@gmail.com |
| Maintainers | jessetane |

## Links

- npm: https://www.npmjs.com/package/base64-transcoder
- Repository: https://github.com/jessetane/base64-transcoder
- Homepage: https://github.com/jessetane/base64-transcoder#readme
- Issues: https://github.com/jessetane/base64-transcoder/issues
- npm.io page: https://npm.io/package/base64-transcoder

## Recent versions

- 1.1.1 (latest) — 2022-05-04
- 1.1.0 — 2020-11-18
- 1.0.0 — 2020-07-27

## README

# base64-transcoder
Base64 transcoding in pure JS. Forked from [base64-js](https://github.com/beatgammit/base64-js). Note that for compatibility with node, this module's default alphabet will decode base64 AND base64-url.

## Methods
Three methods are exposed: `encode`, `decode` and `byteLength`. Each requires a single argument, `encode` and `decode` also accept an optional `alphabet` argument (see `alphabets` property below).

### `encode`
Takes a byte array and returns a base64 string.

### `decode`
Takes a base64 string and returns a byte array.

### `byteLength`
Takes a base64 string and returns length of byte array.

## Properties

### `alphabets`
Use this property to do base64 transcoding with arbitrary alphabets. For example it is possible to implement [base64-url](https://tools.ietf.org/html/rfc4648#section-5) using this interface:
```
b64.alphabets.url = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
var a = b64.toByteArray('aa+/')
var b = b64.fromByteArray(a, 'url')
console.log(b === 'aa-_') // true
```

## Prior art
https://github.com/beatgammit/base64-js

## License
MIT

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