You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-14Lines changed: 16 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,33 +1,35 @@
1
-
# Zipack.JS
1
+
# Zspack
2
2
3
-
Live demo: https://zipack.github.io/#demo
3
+
Live demo: https://zspack.github.io/#demo
4
4
5
-
Zipack.js is an official encoder/decoder of [Zipack](https://zipack.github.io/) format using JavaScript with no dependencies.
5
+
Zspack = zipack + [scsu](https://en.wikipedia.org/wiki/Standard_Compression_Scheme_for_Unicode) , hack for Zipack.js
6
+
7
+
Zipack.js is an official encoder/decoder of [Zipack](https://zspack.github.io/) format using JavaScript with no dependencies.
6
8
7
9
## Install
8
10
9
11
```shell
10
-
npm install zipack-official
12
+
npm install zspack
11
13
```
12
14
13
15
Use ES module in browser or Node.JS:
14
16
15
17
```JavaScript
16
-
importzipackfrom'zipack.js'
18
+
import*aszspackfromfrom'zspack'
17
19
```
18
20
19
21
Prototype:
20
22
21
23
```
22
-
zipack {
24
+
zspack {
23
25
dump(Object) // code
24
26
load(Buffer) // decode
25
27
}
26
28
```
27
29
28
30
## Default JS Objects
29
31
30
-
the types zipack support by default:
32
+
the types zspack support by default:
31
33
32
34
- number
33
35
- string
@@ -52,29 +54,29 @@ let obj = {
52
54
}
53
55
54
56
// JS Object ---> Uint8Array
55
-
let buffer =zipack.dump(obj)
57
+
let buffer =zspack.dump(obj)
56
58
57
59
// Uint8Array ---> JS Object
58
-
obj =zipack.load(buffer)
60
+
obj =zspack.load(buffer)
59
61
```
60
62
61
-
## [Object].prototype.zipack
63
+
## [Object].prototype.zspack
62
64
63
-
like toJSON() in JavaScript, define zipack() for specific Objects, which outputs the types zipack support. For example, Date could be stored as number:
65
+
like toJSON() in JavaScript, define zspack() for specific Objects, which outputs the types zspack support. For example, Date could be stored as number:
64
66
65
-
- function:zipack
67
+
- function:zspack
66
68
- input:none
67
69
- output:default types or Uint8Array
68
70
69
71
```javascript
70
-
Date.prototype.zipack=function () {
72
+
Date.prototype.zspack=function () {
71
73
returnthis.getTime();
72
74
};
73
75
```
74
76
75
77
## Extension (experimental)
76
78
77
-
Register callback(params: Uint8Array) to load zipack, meanwhile, define zipack() returning Uint8Array to dump. See [extend-demo.js](./extend_demo.js).
79
+
Register callback(params: Uint8Array) to load zspack, meanwhile, define zspack() returning Uint8Array to dump. See [extend-demo.js](./extend_demo.js).
0 commit comments