Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

zapret-lib: add expected_ratio to z_readfile

This commit is contained in:
bol-van
2026-01-07 08:31:23 +03:00
parent a61895778b
commit 2def9397a0
2 changed files with 5 additions and 3 deletions

View File

@@ -1520,8 +1520,9 @@ function readfile(filename)
return s
end
-- reads plain or gzipped file with transparent decompression
function z_readfile(filename)
return is_gzip_file(filename) and gunzip_file(filename) or readfile(filename)
-- expected_ratio = uncompressed_size/compressed_size (default 4)
function z_readfile(filename, expected_ratio)
return is_gzip_file(filename) and gunzip_file(filename, expected_ratio) or readfile(filename)
end
-- write data to filename
function writefile(filename, data)