A javascript library for opening NBT files
Can be used on NodeJs and a browser plug'n'play version will be released soon.
By using this library, you can read NBT format files, like Minecraft's *.dat files. You can easy manage the data on a JSON format and preaty print them.
Read the data from the a NBT file
// Get an NBT decoded object by reading the file
// if needed the data will be unzipped
var nbtObj = nbt.decodeFile("hello_world.nbt");
Print the NBT data to the example documentation format
// NBT to String
var stringDocFormat = nbtObj.toString();
console.log(stringDocFormat);
Output
TAG_Compound('hello world'): 1 entries
{
TAG_String('name'): Bananrama
}
Get the NBT data to a JSON format
// NBT to Json format (data types are lost)
// All values are in strings
var nbtJson = nbtObj.toJson();
Example JSON
{
"hello world": {
"name": "Bananrama"
}
}
The data are saved on an object as they are parsed.
// Get Data on the parsed format
var parsedFormat = nbtObj.getData();
Parsed object format
var parsedFormat = {
"type": 10, // TAG_Compound
"name": "hello world",
"payload": [
{
"type": 8, // TAG_String
"name": "name",
"pos": 21,
"payload": "Bananrama"
}
]
}
We started this library in order to read the *.dat files of our Minecraft server on our NodeJs project
Under Construction
Under Construction
Under Construction
Under Construction
Under Construction - MIT License