Nbt Module
![Build Status](https://github.com/voxelum/minecraft-launcher-core-node/workflows/Release%20Pre-Check/badge.svg)
This is a sub-module belong to minecraft-launcher-core module. You can still use this individually.
Usage
Read/Write NBT
You can simply deserialize/serialize nbt.
import { NBT } from "@xmcl/nbt";
const fileData: Buffer;
const compressed: true | "gzip" | "deflate" | undefined;
const readed: NBT.TypedObject = await NBT.deserialize(fileData, { compressed });
const buf: Buffer = await NBT.serialize(readed, { compressed });
const serial = NBT.createSerializer()
.register("server", {
name: NBT.TagType.String,
host: NBT.TagType.String,
port: NBT.TagType.Int,
icon: NBT.TagType.String,
});
const serverInfo: any;
const serialized: Buffer = await serial.serialize(serverInfo, "server");