1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compress: add a new module compress.gzip too (#14686)

This commit is contained in:
Leo Developer
2022-06-05 17:53:45 +02:00
committed by GitHub
parent 7b25957a26
commit 3a90d8ef14
8 changed files with 277 additions and 13 deletions

View File

@ -4,7 +4,6 @@ import compress
// compresses an array of bytes using zlib and returns the compressed bytes in a new array
// Example: compressed := zlib.compress(b)?
[manualfree]
pub fn compress(data []u8) ?[]u8 {
// flags = TDEFL_WRITE_ZLIB_HEADER (0x01000)
return compress.compress(data, 0x01000)
@ -12,7 +11,6 @@ pub fn compress(data []u8) ?[]u8 {
// decompresses an array of bytes using zlib and returns the decompressed bytes in a new array
// Example: decompressed := zlib.decompress(b)?
[manualfree]
pub fn decompress(data []u8) ?[]u8 {
// flags = TINFL_FLAG_PARSE_ZLIB_HEADER (0x1)
return compress.decompress(data, 0x1)