Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tigercrl/nbt-parser
Minecraft NBT (NamedBinary Tags) parser for Node.js
https://github.com/tigercrl/nbt-parser
minecraft nbt nodejs npm parser snbt
Last synced: 3 months ago
JSON representation
Minecraft NBT (NamedBinary Tags) parser for Node.js
- Host: GitHub
- URL: https://github.com/tigercrl/nbt-parser
- Owner: Tigercrl
- License: gpl-3.0
- Created: 2024-09-02T11:32:19.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-04T12:14:53.000Z (4 months ago)
- Last Synced: 2024-10-15T17:06:27.482Z (3 months ago)
- Topics: minecraft, nbt, nodejs, npm, parser, snbt
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/nbt-parser
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NBT-Parser
Minecraft NBT (NamedBinary Tags) parser for Node.js
## Supports
* Java & Bedrock(Not tested) edition
* Parsing NBT / SNBT to JSON
* Dumping JSON to NBT## Installation
```
npm install nbt-parser
```## Usage
```typescript
// Importing
const NBT = require('nbt-parser');
// or
import NBT from "nbt-parser";// Parse NBT
const nbt = NBT.parseJSON({ key: "value" });
const nbt = NBT.parseNBT(new Uint8Array([]), 'java');
const nbt = NBT.parseSNBT("{key:value}");// Dumping NBT
nbt.toJSON();
nbt.toJSONString();
nbt.toNBT('gzip', 'java');
nbt.toSNBT('formatted');// Getting tags or payloads
const tag = nbt.getRootTag();
// tag.getTagName(), tag.getTagId() ...
const payload = tag.getPayload();
// payload.getValue(), payload.toSNBTValue(), payload.toUint8Array()...
```