"Sputnik" help  
Sputnik Help
NbtCompoundCompress(<nbtCompound>)

Description

Compresses an NBT compound into a binary string.

Parameters

<nbtCompound> The NBT compound to compress into a binary string.

Return Value

Success: Returns a binary string representing the compressed NBT compound.
Failure: Returns null if the provided nbtCompound parameter is not a valid NBT compound or if the compression fails.

Remarks

The NbtCompoundCompress function allows you to compress an NBT compound into a binary string using the GZip compression algorithm. GZip is a widely used compression algorithm that provides efficient data compression. The resulting binary string represents the compressed form of the NBT compound, reducing its size for efficient storage or transmission. If the provided nbtCompound parameter is not a valid NBT compound or if the compression process fails, the function returns null.

Related

NbtCompoundDecompress

Example

Example of usage:

NbtCompoundSet($nbt, "Cat", "Meow");
NbtCompoundSet($nbt, "Dog", "Woof");

my $data = NbtCompoundCompress($nbt);
say BinaryExpand($data);

unset($nbt);

my $nbt = NbtCompoundDecompress($data);

say $nbt;

foreach(my $key => my $value in NbtCompoundGetMap($nbt))
    say "[$key] = $value";

// PRINTS
// 00 | 4E 42 54 21 32 00 00 00 1F 8B 08 00 00 00 00 00 NBT!2...........
// 01 | 04 00 F3 73 0A 51 E4 62 60 60 60 76 4E 2C 01 52 ..ós.Qäb```vN,.R
// 02 | 2C BE A9 F9 E5 60 BE 4B 7E 3A 88 1F 9E 9F 9F C6 ,.©ùå`.K~:.....Æ
// 03 | 00 00 C9 B1 E7 AB 25 00 00 00 -- -- -- -- -- -- ..ɱç«%...
// {NBTTag;Compound::[Cat:Meow,Dog:Woof]}
// [Cat] = Meow
// [Dog] = Woof

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org