Description
Describe the project you are working on
Godot
Describe the problem or limitation you are having in your project
The compression_mode
argument of PackedByteArray.compress/decompress/decompress_dynamic
and FileAccess.open_compressed
is 0 (COMPRESSION_FASTLZ) by default.
This is less than ideal, as it is necessary to ensure the compression methods match during compression and decompression. Generally, you should always explicitly set the compression method rather than relying on default values.
PackedByteArray decompress_dynamic(max_output_size: int, compression_mode: int = 0) const 🔗
Returns a new PackedByteArray with the data decompressed. Set the compression mode using one of CompressionMode's constants. This method only accepts brotli, gzip, and deflate compression modes.
decompress_dynamic
does not support fastlz, so the default value makes no sense.
In addition, fastlz is a relatively old compression and doesn't have much advantages compared to modern compression such as zstd or lz4. https://github.com/inikep/lzbench/blob/master/doc/lzbench20_sorted.md. Setting it as the default value seems to imply that we recommend using it.
Related C# binding: godotengine/godot#106008
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Make the compression_mode
argument required.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Modify the method binding of PackedByteArray
and FileAccess
to make the compression_mode
argument required, but this breaks compatibility.
If this enhancement will not be used often, can it be worked around with a few lines of script?
N/A
Is there a reason why this should be core and not an add-on in the asset library?
N/A