File tree 5 files changed +1181
-274
lines changed
5 files changed +1181
-274
lines changed Original file line number Diff line number Diff line change 1
1
# lzo.ts
2
2
3
- a simple ~ 1.3 kB minified and gzipped implementation of the lzo1x codec written in TypeScript
3
+ a simple ~ 1.4 kB minified and gzipped implementation of the lzo1x codec written in TypeScript
4
4
5
- ## Installation
5
+ ## Installation & Usage
6
+
7
+ ### Node.js
6
8
7
9
Install the package using your desired package manager.
8
10
9
11
lzo.ts is fully compatible with yarn, pnpm, deno and bun.
10
12
11
13
``` bash
12
- $ npm install lzo-ts
14
+ npm install lzo-ts
13
15
```
14
16
15
- ## Usage
16
-
17
17
``` ts
18
- import { LZO } from ' node -ts' ;
18
+ import { LZO } from ' lzo -ts' ;
19
19
20
- const input = ' Compress me! ' ;
20
+ const input = new TextEncoder (). encode ( ' Hello world! ' ) ;
21
21
22
22
const compressed = LZO .compress (input );
23
23
24
24
const decompressed = LZO .decompress (compressed );
25
25
26
- console .log (decompressed ); // Returns "Compress me!"
26
+ console .log (decompressed ); // Returns "Hello world!"
27
+ ```
28
+
29
+ ### Web environment
30
+
31
+ If you are using the library in a web environment, you can include it directly from a CDN of your choice.
32
+
33
+ ``` html
34
+ <script src =" https://www.unpkg.com/lzo-ts" ></script >
35
+ <script >
36
+ const { LZO } = lzoTs;
37
+
38
+ LZO .compress (/* ...*/ );
39
+ LZO .decompress (/* ...*/ );
40
+ </script >
27
41
```
28
42
29
43
## Credits
Original file line number Diff line number Diff line change @@ -4,9 +4,8 @@ const options: Parameters<typeof build>[0] = {
4
4
bundle : true ,
5
5
entryPoints : [ 'src/index.ts' ] ,
6
6
external : [ 'lzo-ts' ] ,
7
+ mangleProps : / ^ _ / ,
7
8
minify : true ,
8
- mangleProps : / .* / ,
9
- reserveProps : / ^ c o m p r e s s $ | ^ d e c o m p r e s s $ / ,
10
9
} ;
11
10
12
11
// Platform neutral
You can’t perform that action at this time.
0 commit comments