The Symbol
used to store the root name property of an NBT file.
The Symbol
used to store the NBT Tag Type of a JavaScript Object
.
To set this for your own objects, use createNBTType
. This can be inferred in a majority of cases.
Specify that a number
should be serialized as a TAG_BYTE
Specify that a number[]
should be serialized as a TAG_BYTE_ARRAY
.
All the numbers must be integers between -128 and 127, otherwise an error is thrown upon serialization.
Specify that a value any
should be serialized as a TAG_COMPOUND
.
This has no effect on any resulting NBT, and is only included for consistency
Specify that a number
should be serialized as a TAG_DOUBLE
This is pointless as number
s, are serialized as
TAG_DOUBLE
unless specified otherwise
Specify that a number
should be serialized as a TAG_FLOAT
Specify that a number
should be serialized as a TAG_INT
Specify that a number[]
should be serialized as a TAG_INT_ARRAY
.
All the numbers must be integers between -2,147,483,648 and 2,147,483,647, otherwise an error will be thrown upon serialization.
Specify that an array should be serialized as a TAG_LIST
.
All the items must have the same TAG_
type, otherwise an error
will be thrown upon serialisation. Where possible, this is automatically extracted.
Specify that this number
should be serialized as a TAG_LONG
This is pointless on a Long
, which are serialized as
TAG_LONG
unless specified otherwise
Specify that a given Long[]
should be serialized as a TAG_LONG_ARRAY
Specify that a number
should be serialized as a TAG_SHORT
Specify that a string
should be serialized as a TAG_STRING
Create a value which is to be serialized as a specific type.
The TagType
which is to be serialized
Same as deserializeNBT
, but if buffer
contains compressed data, it will be uncompressed automatically. If this behaviour is not required, use the synchronous deserializeNBT
function instead.
The buffer to deserialize the NBT from.
to use ES6 maps for compounds. This is useful to retain insertion order
Whether or not the root is named. For example, a typical structure is {"":}.
Deserialize an NBT value from buffer
. This returns an object which is
the closest JavaScript equivalent of the input.
TAG_LONG
s, which cannot be losslessly represented in a JavaScript
number
, are deserialized as Long
s from the
long
package.
Deserialize an NBT value from buffer
. This returns an object which is the closest JavaScript equivalent of the input.
TAG_LONG
s, which cannot be losslessly represented in a JavaScript number
, are deserialized as Long
s from the long
package.
The resulting object can be serialized into the same NBT value. This is explained fully in the README
.
The buffer to deserialize the NBT from
Whether to use ES6 Map
s for compounds. This is useful to retain insertion order
Whether or not the root is named. For example, a typical structure is {"":}. (Reasoning for this required)
Serialize from a JavaScript value into an equivalent NBT value.
If value
this was deserialized from NBT using deserializeNBT
,
this should create an identical NBT value to the one it was originally
deserialized from(1).
(1) This is only guaranteed to be true if the useMaps
flag was set,
due to the non-guaranteed iteration order of the object primitive.
Serialize value
into defaultBuffer
, throwing an error if any different value is written.
Only intended for use in testing and debugging of this library. Changing the signature of this function MAY occur in any non-patch release
Generated using TypeDoc
The
Symbol
used to store the type of the item in aTAG_LIST
. This is attached as a property on theArray
.