Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/levelz-file/js-bindings
JavaScript Parser & API for the LevelZ File Format
https://github.com/levelz-file/js-bindings
javascript js levelz nodejs web
Last synced: 3 months ago
JSON representation
JavaScript Parser & API for the LevelZ File Format
- Host: GitHub
- URL: https://github.com/levelz-file/js-bindings
- Owner: LevelZ-File
- License: mit
- Created: 2024-03-04T06:26:23.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-10-27T19:37:49.000Z (3 months ago)
- Last Synced: 2024-10-28T00:49:12.058Z (3 months ago)
- Topics: javascript, js, levelz, nodejs, web
- Language: JavaScript
- Homepage: https://levelz-file.github.io/js-bindings/
- Size: 959 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# levelz-js
![GitHub License](https://img.shields.io/github/license/LevelZ-File/js-bindings)
[![GitHub package.json version](https://img.shields.io/github/package-json/v/LevelZ-File/js-bindings)](https://www.npmjs.com/package/levelz-js)
[![Static Badge](https://img.shields.io/badge/documentation-jsdoc-blue)](https://levelz-file.github.io/js-bindings)
![NPM Downloads](https://img.shields.io/npm/d18m/levelz-js)> JavaScript Bindings for the LevelZ File Format
## Overview
Provides JavaScript bindings for the LevelZ File Format.
## Installation
### System
```bash
# NPM
npm install levelz-js# Yarn
yarn add levelz-js# Bun
bun install levelz-js
```### Web
```html
```
## Usage
```js
import { Coordinate2D } from 'levelz-js';const coordinate = new Coordinate2D(1, 2);
console.log(coordinate.toString()); // [1, 2]
``````js
import * as fs from 'fs';
import { parseLevel } from 'levelz-js';const txt = fs.readFileSync('my_level.lvlz', { encoding: 'utf-8' });
const level = parseLevel(txt);console.log(level.headers.get('type')) // 3
``````js
import * as LevelZ from 'levelz-js'const coordinate3D = new LevelZ.Coordinate3D(1, 2, 3);
console.log(coordinate3D.toString()); // [1, 2, 3]const level = new LevelZ.Level2D({'type': '3', 'spawn', '[0, 0, 0]'});
console.log(level.toString()); // @type 3, @spawn [0, 0, 0]
```