base128-ascii 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
Smaller than
|
|
1
|
+
Smaller than base64, only use ASCII, can run in web browser.
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
2
4
|
|
|
3
5
|
```
|
|
4
6
|
npm i base128-ascii
|
|
@@ -6,6 +8,10 @@ npm i base128-ascii
|
|
|
6
8
|
|
|
7
9
|
```js
|
|
8
10
|
import base128 from "base128-ascii"
|
|
11
|
+
|
|
12
|
+
const encodedTemplate = base128.encode(Uint8Array.from(fs.readFileSync("example.gz"))).toJSTemplateLiterals()
|
|
13
|
+
|
|
14
|
+
const decoded = base128.decode(eval(encodedTemplate))
|
|
9
15
|
```
|
|
10
16
|
|
|
11
17
|
---
|
|
@@ -16,7 +22,7 @@ Char Code (ASCII) :
|
|
|
16
22
|
'\0\1\2\3\4\5\6\7\b\t\n\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F'
|
|
17
23
|
```
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
Encode this jpg file, use base128 is 102KiB smaller than base64:
|
|
20
26
|
|
|
21
27
|
```
|
|
22
28
|
screenshot-45.519.jpg
|
|
@@ -32,6 +38,8 @@ base64:
|
|
|
32
38
|
length: 909448
|
|
33
39
|
```
|
|
34
40
|
|
|
41
|
+

|
|
42
|
+
|
|
35
43
|
---
|
|
36
44
|
|
|
37
45
|
The project was born for [vite-plugin-singlefile-compression](https://github.com/bddjr/vite-plugin-singlefile-compression).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "base128-ascii",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@types/node": "^22.10.5",
|
|
31
31
|
"rimraf": "^6.0.1",
|
|
32
|
-
"typescript": "^5.7.
|
|
32
|
+
"typescript": "^5.7.3"
|
|
33
33
|
}
|
|
34
34
|
}
|