@avensaas/nbt-parser
v0.1.1
Published
Minecraft NBT (NamedBinary Tags) parser for Node.js with Typescript support (Credits to Tigercrl)
Downloads
67
Maintainers
Readme
@smpsaas/nbt-parser
Minecraft NBT (NamedBinary Tags) parser for Node.js with Typescript support
Supports
- Java & Bedrock(Not tested) edition
- Parsing NBT / SNBT to JSON
- Dumping JSON to NBT
Installation
npm install @smpsaas/nbt-parser
Usage
// Importing
const NBT = require("@smpsaas/nbt-parser");
// or
import NBT from "@smpsaas/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()...
All credits go to the owner of the source code