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:
@@ -3,9 +3,6 @@
|
||||
`compress.deflate` is a module that assists in the compression and
|
||||
decompression of binary data using `deflate` compression
|
||||
|
||||
NOTE: To decompress gzip, discard first 10 bytes of compressed bytes
|
||||
then use `compress.deflate.decompress`. (Header validation won't be
|
||||
performed in this case)
|
||||
|
||||
## Examples:
|
||||
|
||||
|
||||
@@ -2,15 +2,14 @@ module deflate
|
||||
|
||||
import compress
|
||||
|
||||
// compresses an array of bytes using gzip and returns the compressed bytes in a new array
|
||||
// Example: compressed := gzip.compress(b)?
|
||||
// compresses an array of bytes using deflate and returns the compressed bytes in a new array
|
||||
// Example: compressed := deflate.compress(b)?
|
||||
pub fn compress(data []u8) ?[]u8 {
|
||||
return compress.compress(data, 0)
|
||||
}
|
||||
|
||||
// decompresses an array of bytes using zlib and returns the decompressed bytes in a new array
|
||||
// Example: decompressed := zlib.decompress(b)?
|
||||
[manualfree]
|
||||
// decompresses an array of bytes using deflate and returns the decompressed bytes in a new array
|
||||
// Example: decompressed := deflate.decompress(b)?
|
||||
pub fn decompress(data []u8) ?[]u8 {
|
||||
return compress.decompress(data, 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user