From 358a929a1ba01cac2bf7bbb6c6729634c1ef1a34 Mon Sep 17 00:00:00 2001 From: Abdelrahman Farid Date: Fri, 16 Feb 2024 00:05:54 +0200 Subject: [PATCH] Update README.md with an example that uses the stream API to extract an in-memory archive (#336) * Update zip.c and zip.h with new functions for reading in-memory zip archives * Revert "Update zip.c and zip.h with new functions for reading in-memory zip archives" This reverts commit 3028843e070da95fb70344114d76d9cfc25eabd7. * Add extra example to extracting in-memory archives * Format example better --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 7550c7c5..67075b3e 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,13 @@ int on_extract_entry(const char *filename, void *arg) { return 0; } +// From "foo.zip" on disk int arg = 2; zip_extract("foo.zip", "/tmp", on_extract_entry, &arg); + +// Or from memory +arg = 2; +zip_stream_extract(zipstream, zipstreamsize, "/tmp", on_extract_entry, &arg); ``` * Extract a zip entry into memory.