NBTify-readonly-typeless
This repository is a fork of NBTify with all functionality except reading NBT files removed. Specialised classes for different types (e.g. Int16 extends Number
, Float32 extends Number
etc.) have been removed, meaning there is no way to differentiate between different number types. Lists of numbers have also been compacted into TypedArray
s, which store numbers much more compactly than individual objects for each number.
Overall, it is much more memory efficient and a little bit faster than NBTify, for the cost of being very limited in functionality.
Please refer to NBTify's readme for more information.
Usage
In the browser:
<script type="importmap">
{
"imports": {
"nbtify-readonly-typeless": "https://esm.sh/nbtify-readonly-typeless@1.1.2" // Remove @1.1.2 to use latest version
}
}
</script>
<script type="module">
import * as NBT from "nbtify-readonly-typeless";
let file = await fetch("./hermitcraft9.mcstructure").then(res => res.blob());
let nbt = await NBT.read(file);
console.log(nbt);
</script>
In Node:
npm i nbtify-readonly-typeless
import * as NBT from "nbtify-readonly-typeless";