An open API service indexing awesome lists of open source software.

https://github.com/bddjr/base128

Smaller than Base64, only use ASCII, can run in web browser.
https://github.com/bddjr/base128

ascii base128 base64 javascript js ts typescript

Last synced: about 2 months ago
JSON representation

Smaller than Base64, only use ASCII, can run in web browser.

Awesome Lists containing this project

README

          

Smaller than base64, only use ASCII, can run in web browser.

Build for [vite-plugin-singlefile-compression](https://github.com/bddjr/vite-plugin-singlefile-compression)

## Setup

### npm

```
npm i base128-ascii
```

```js
import base128 from "base128-ascii"
import fs from "fs"

const encodedTemplate = base128.encode(fs.readFileSync("example.gz")).toJSTemplateLiterals()

const decoded = base128.decode(eval(encodedTemplate))
```

---

## Effect

Encode this jpg file, use base128 is `109.85 KiB` smaller than base64:

```
screenshot-45.519.jpg
file length: 682086

base128:
toJSTemplateLiterals length: 796961
equal: true

base64:
encoded length: 909448
```