2.1.0 • Published 11 months ago

base128-ascii v2.1.0

Weekly downloads
-
License
Unlicense
Repository
github
Last release
11 months ago

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

The project was born for vite-plugin-singlefile-compression.

Setup

npm i base128-ascii
import base128 from "base128-ascii"
import fs from 'fs'

const encodedTemplate = base128.encode(Uint8Array.from(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

encode:
bytes length: 796961
eval length: 779527
decoded length: 682086
equal: true

base64:
length: 909448

npm.io

2.1.0

11 months ago

2.0.3

12 months ago

2.0.2

12 months ago

2.0.1

12 months ago

2.0.0

12 months ago

1.0.0

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago