zip_read
lib callCapy
function zip_read(path : string, entry : string) any
Description
zip_read() reads one entry from an archive file. path is a file path, not archive bytes. The result can contain arbitrary bytes, including zero bytes. It does not decode text.
Entry names must be relative. Backslashes become slashes. Absolute names, colons, control bytes, and .. components are rejected.
Missing entries, unreadable archives, decompression errors, and configured limits return a failure. Empty entry content succeeds with value: "". Default limits are 64 MiB of archive input and 64 MiB of uncompressed entry data.
Parameters
path : archive path
entry : entry name
Return Values
{ok: true, value: ...} on success, or {ok: false, error: "..."} on failure. The value field contains the entry bytes.
Example
Capy
var archive := file_temp()
zip_create(archive, {"note.txt": "hello"})
print(zip_read(archive, "note.txt").value ?? "", "\n")
Output
hello