An open API service indexing awesome lists of open source software.

https://github.com/kelly-dance/nbt_parser

NBT Data parser for Deno
https://github.com/kelly-dance/nbt_parser

deno minecraft

Last synced: 25 days ago
JSON representation

NBT Data parser for Deno

Awesome Lists containing this project

README

          

# nbt_parser

Simple module used to parse nbt data in Deno.

Based on https://github.com/sjmulder/nbt-js

https://deno.land/x/nbt_parser

## How to use

```ts
import { parse, simplify } from 'https://raw.githubusercontent.com/mcbobby123/nbt_parser/master/index.ts';

const data: UInt8Array; // Some NBT data represented as a UInt8Array

const nbt = parse(data);

// To remove type tags use

const simpleNbt = simplify(nbt);
```

## Typing

```ts
import { Tag, Types } from 'https://raw.githubusercontent.com/mcbobby123/nbt_parser/master/index.ts';

// Tag is an Enum containing the ids of each tag type

Tag.byte // 1
Tag.short // 2
Tag.int // 3
// ... etc

// Types maps the ids to their respective types

type IntTag = Types[Tag.int]; // { type: 3, value: number }

```