Skip to content

Commit 1fed48f

Browse files
author
Gregory Mitchell
authored
Update README.md
1 parent 66db025 commit 1fed48f

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ bun install levelz-js
2929
### Web
3030

3131
```html
32+
<!-- Use Minified Version -->
3233
<script src="https://levelz-file.github.io/js-bindings/levelz.min.js"></script>
34+
35+
<!-- Use Readable Version -->
36+
<script src="https://levelz-file.github.io/js-bindings/levelz.js"></script>
3337
```
3438

3539
## Usage
@@ -39,4 +43,24 @@ import { Coordinate2D } from 'levelz-js';
3943

4044
const coordinate = new Coordinate2D(1, 2);
4145
console.log(coordinate.toString()); // [1, 2]
42-
```
46+
```
47+
48+
```js
49+
import * as fs from 'fs';
50+
import { parseLevel } from 'levelz-js';
51+
52+
const txt = fs.readFileSync('my_level.lvlz', { encoding: 'utf-8' });
53+
const level = parseLevel(txt);
54+
55+
console.log(level.headers.get('type')) // 3
56+
```
57+
58+
```js
59+
import * as LevelZ from 'levelz-js'
60+
61+
const coordinate3D = new LevelZ.Coordinate3D(1, 2, 3);
62+
console.log(coordinate3D.toString()); // [1, 2, 3]
63+
64+
const level = new LevelZ.Level2D({'type': '3', 'spawn', '[0, 0, 0]'});
65+
console.log(level.toString()); // @type 3, @spawn [0, 0, 0]
66+
```

0 commit comments

Comments
 (0)