You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decompresses a DEFLATE-compressed string (one might call this an "INFLATE" function). Compatible with gzip and zlib headers and footers.
508
508
#### Parameters
509
-
1. The string to decompress.
509
+
1.`data` — The string to decompress.
510
+
2.`offset` — Optional starting position inside `data`, using `string.sub` semantics. Defaults to the beginning of `data`. To provide an `offset` without a decompressed size, pass `nil` as the third argument.
511
+
3.`decompressed_size` — Optional size of the decompressed output. When only two arguments are given, the second argument is treated as `decompressed_size`.
510
512
#### Returns
511
513
1. The decompressed string.
512
514
2. A table with extra information: `compressed_size`, `checksum_present`, `checksum_mismatch`
513
515
```pluto
514
-
local decompressed, info = require"crypto".decompress("\xF3\x48\xCD\xC9\xC9\xD7\x51\x08\xC8\x29\x2D\xC9\x57\x04")
516
+
local deflated = "\xF3\x48\xCD\xC9\xC9\xD7\x51\x08\xC8\x29\x2D\xC9\x57\x04"
517
+
518
+
local decompressed, info = require"crypto".decompress(deflated)
515
519
print(decompressed) --> Hello, Pluto!
516
520
print(info.compressed_size) --> 14
517
521
print(info.checksum_present) --> false
518
522
print(info.checksum_mismatch) --> false
523
+
524
+
-- Decompress from an offset
525
+
decompressed, info = require"crypto".decompress("Don't mind me" .. deflated, 14, nil)
0 commit comments