1.90.1 • Published 2 months ago

nbtify v1.90.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

NBTify

npm downloads

Following in the footsteps of NBT.js and Prismarine-NBT, NBTify is a JavaScript library that allows for the parsing of NBT files on the web!

I started this project as a learning experience to try and make my own NBT parser from scratch. I didn't have much success in making it work reliably, so I've decided to make a brand-new fork of NBT.js that will support Bedrock Edition's little endian NBT format, one of my goals that spurred the idea for making a new library.

Prismarine-NBT seemed like a viable option to NBT.js, as it supports both Bedrock and Java formats. However, it doesn't support the browser out of the box, and bundling it seems fairly bloated just to support the browser. NBT.js is really compact, so I didn't want to take the option with more dependencies.

I really like the functionality of Prismarine-NBT and the simplicity of NBT.js, so I thought, why not meet somewhere in the middle?

NBTify has entered the chat!

Usage

Importing NBTify in the browser:

<script type="module">
  import * as NBT from "https://cdn.jsdelivr.net/npm/nbtify/dist/index.min.js";
</script>

Importing NBTify in Node:

import * as NBT from "nbtify";

Reading a file using the Fetch API in the browser:

const response: Response = await fetch("./bigtest.nbt");
const arrayBuffer: ArrayBuffer = await response.arrayBuffer();
const data: NBTData = await NBT.read(arrayBuffer);

Reading a file using the File System module in Node:

import { readFile } from "node:fs/promises";

const buffer: Buffer = await readFile("./bigtest.nbt");
const data: NBTData = await NBT.read(buffer);

Writing to a file using the File API in the browser:

const result: Uint8Array = await NBT.write(data);
const file: File = new File([result],"bigtest.nbt");

Writing to a file using the File System module in Node:

import { writeFile } from "node:fs/promises";

const result: Uint8Array = await NBT.write(data);
await writeFile("./bigtest.nbt",result);
1.90.1

2 months ago

1.90.0

2 months ago

1.85.0

4 months ago

1.80.0

5 months ago

1.75.0

8 months ago

1.35.1

11 months ago

1.68.0

8 months ago

1.44.1

11 months ago

1.35.2

11 months ago

1.69.0

8 months ago

1.35.0

11 months ago

1.35.3

11 months ago

1.69.420

8 months ago

1.60.0

10 months ago

1.60.2

10 months ago

1.60.1

10 months ago

1.63.0

9 months ago

1.44.0

11 months ago

1.20.1

1 year ago

1.20.0

1 year ago

1.12.0

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago