Skip to content

Commit 25f000f

Browse files
committed
Release 0.2.0
1 parent d27dd03 commit 25f000f

File tree

5 files changed

+1181
-274
lines changed

5 files changed

+1181
-274
lines changed

README.md

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
11
# lzo.ts
22

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
44

5-
## Installation
5+
## Installation & Usage
6+
7+
### Node.js
68

79
Install the package using your desired package manager.
810

911
lzo.ts is fully compatible with yarn, pnpm, deno and bun.
1012

1113
```bash
12-
$ npm install lzo-ts
14+
npm install lzo-ts
1315
```
1416

15-
## Usage
16-
1717
```ts
18-
import { LZO } from 'node-ts';
18+
import { LZO } from 'lzo-ts';
1919

20-
const input = 'Compress me!';
20+
const input = new TextEncoder().encode('Hello world!');
2121

2222
const compressed = LZO.compress(input);
2323

2424
const decompressed = LZO.decompress(compressed);
2525

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>
2741
```
2842

2943
## Credits

build/bundle.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ const options: Parameters<typeof build>[0] = {
44
bundle: true,
55
entryPoints: ['src/index.ts'],
66
external: ['lzo-ts'],
7+
mangleProps: /^_/,
78
minify: true,
8-
mangleProps: /.*/,
9-
reserveProps: /^compress$|^decompress$/,
109
};
1110

1211
// Platform neutral

0 commit comments

Comments
 (0)