Package Exports
- prismarine-nbt
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prismarine-nbt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Prismarine-NBT
Prismarine-NBT is a JavaScript parser and serializer for NBT archives, for use with Node.js.
Usage
var fs = require('fs'),
nbt = require('prismarine-nbt');
fs.readFile('bigtest.nbt', function(error, data) {
if (error) throw error;
nbt.parse(data, function(error, data) {
console.log(data.value.stringTest.value);
console.log(data.value['nested compound test'].value);
});
});
If the data is gzipped, it is automatically decompressed first.
API
writeUncompressed(value,[isLittleEndian])
Returns a buffer with a serialized nbt value
. If isLittleEndian is passed and is true, write little endian nbt (mcpe).
parseUncompressed(data,[isLittleEndian])
Takes a buffer data
and returns a parsed nbt value. If isLittleEndian is passed and is true, read little endian nbt (mcpe).
parse(data,[isLittleEndian], callback)
Takes an optionally compressed data
and provide a parsed nbt value in the callback(err,value)
.
If isLittleEndian is passed and is true, read little endian nbt (mcpe).
simplify(nbt)
Returns a simplified nbt representation : keep only the value to remove one level. This loses the types so you cannot use the resulting representation to write it back to nbt.
proto
Provide the protodef instance used to parse and serialize nbt.
protoLE
Provide the protodef instance used to parse and serialize little endian nbt.