From 0e3aeab15a47a24b701d18b7bc82b8d23dfa9c2c Mon Sep 17 00:00:00 2001 From: RDW Date: Wed, 21 Aug 2024 02:27:17 +0200 Subject: [PATCH 1/5] Docs: Add a reference for miniz.new_reader_memory Pending review; keep this open as a reminder and merge after the next release was published. --- docs/references/api/bindings/miniz.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/references/api/bindings/miniz.md b/docs/references/api/bindings/miniz.md index 831961d9..d099a3ab 100644 --- a/docs/references/api/bindings/miniz.md +++ b/docs/references/api/bindings/miniz.md @@ -85,7 +85,7 @@ Applies [INFLATE](https://en.wikipedia.org/wiki/Deflate#Decoder/decompressor) to ## ZipFileReader -Created by [new_reader](#new_reader). You can use this to get information about the files within a ZIP archive or to extract them (in-memory). +Created by [new_reader](#new_reader) or [new_reader_memory](#new_reader_memory). You can use this to get information about the files within a ZIP archive or to extract them (in-memory). ### extract @@ -389,6 +389,20 @@ Creates a new ZIP file reader for the given `fileSystemPath`. The `flags` passed +### new_reader_memory + +Creates a new ZIP file reader for the given `fileContents`. The `flags` passed to `miniz` can control the way that the archive is read. + + + + + + + + + + + ### new_writer Creates a new ZIP file writer for the given `fileSystemPath`. The `flags` passed to `miniz` can control the way that the archive is written. From bcbb4edd3d6cca612ea64d6ac0bb30b883bec564 Mon Sep 17 00:00:00 2001 From: RDW Date: Mon, 17 Feb 2025 10:45:40 +0100 Subject: [PATCH 2/5] Docs: Add info blocks to the miniz reader reference --- docs/references/api/bindings/miniz.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/references/api/bindings/miniz.md b/docs/references/api/bindings/miniz.md index d099a3ab..7ad5a381 100644 --- a/docs/references/api/bindings/miniz.md +++ b/docs/references/api/bindings/miniz.md @@ -379,6 +379,10 @@ Creates a new [Inflator](#inflator) object and returns a `userdata` reference to Creates a new ZIP file reader for the given `fileSystemPath`. The `flags` passed to `miniz` can control the way that the archive is read. +:::info +This function is suitable if loading the entire file into memory is acceptable. Use a [deflator](#deflator) for streaming. +::: + @@ -393,6 +397,10 @@ Creates a new ZIP file reader for the given `fileSystemPath`. The `flags` passed Creates a new ZIP file reader for the given `fileContents`. The `flags` passed to `miniz` can control the way that the archive is read. +:::info +This function is suitable if loading the entire file into memory is acceptable. Use a [deflator](#deflator) for streaming. +::: + From c173bd784d2ee0350c62534d3d056f633c02381c Mon Sep 17 00:00:00 2001 From: RDW Date: Mon, 17 Feb 2025 10:47:44 +0100 Subject: [PATCH 3/5] Docs: Mention different use cases for miniz readers --- docs/references/api/bindings/miniz.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/references/api/bindings/miniz.md b/docs/references/api/bindings/miniz.md index 7ad5a381..2ebbedbd 100644 --- a/docs/references/api/bindings/miniz.md +++ b/docs/references/api/bindings/miniz.md @@ -377,7 +377,7 @@ Creates a new [Inflator](#inflator) object and returns a `userdata` reference to ### new_reader -Creates a new ZIP file reader for the given `fileSystemPath`. The `flags` passed to `miniz` can control the way that the archive is read. +Creates a new ZIP file reader for the given `fileSystemPath`. The `flags` passed to `miniz` can control the way that the archive is read. This method will automatically load the ZIP file from disk and attempt to decode it. :::info This function is suitable if loading the entire file into memory is acceptable. Use a [deflator](#deflator) for streaming. @@ -395,7 +395,7 @@ This function is suitable if loading the entire file into memory is acceptable. ### new_reader_memory -Creates a new ZIP file reader for the given `fileContents`. The `flags` passed to `miniz` can control the way that the archive is read. +Creates a new ZIP file reader for the given `fileContents`. The `flags` passed to `miniz` can control the way that the archive is read. You must handle reading the file from disk yourself, however you see fit. :::info This function is suitable if loading the entire file into memory is acceptable. Use a [deflator](#deflator) for streaming. From bdaa00310bd148616e1aa86f06ad6b48fd83cac3 Mon Sep 17 00:00:00 2001 From: RDW Date: Mon, 17 Feb 2025 10:50:17 +0100 Subject: [PATCH 4/5] Docs: Adjust the referenced miniz reader returns There should be a standard way of denoting failure tuples, but right now there isn't. Maybe one day... --- docs/references/api/bindings/miniz.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/references/api/bindings/miniz.md b/docs/references/api/bindings/miniz.md index 2ebbedbd..8ba380e5 100644 --- a/docs/references/api/bindings/miniz.md +++ b/docs/references/api/bindings/miniz.md @@ -383,13 +383,16 @@ Creates a new ZIP file reader for the given `fileSystemPath`. The `flags` passed This function is suitable if loading the entire file into memory is acceptable. Use a [deflator](#deflator) for streaming. ::: +Returns `nil` and an error message in case of failure. Otherwise the ZIP [reader](#ZipFileReader) should be ready to use. + - + + @@ -401,13 +404,16 @@ Creates a new ZIP file reader for the given `fileContents`. The `flags` passed t This function is suitable if loading the entire file into memory is acceptable. Use a [deflator](#deflator) for streaming. ::: +Returns `nil` and an error message in case of failure. Otherwise the ZIP [reader](#ZipFileReader) should be ready to use. + - + + From 47d4eff07815959277ca2ba11a37a85184045b78 Mon Sep 17 00:00:00 2001 From: RDW Date: Mon, 17 Feb 2025 13:25:37 +0100 Subject: [PATCH 5/5] API: Update the miniz API changelog for v0.0.20 --- docs/references/api/bindings/miniz.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/references/api/bindings/miniz.md b/docs/references/api/bindings/miniz.md index 8ba380e5..11c19299 100644 --- a/docs/references/api/bindings/miniz.md +++ b/docs/references/api/bindings/miniz.md @@ -471,6 +471,7 @@ Returns the version number of the embedded `miniz` library as a Lua string. ## Changelog -| Version | What happened? | -| :-----: | :-------------: | -| v0.0.5 | Initial release | +| Version | What happened? | +| :-----: | :-----------------------: | +| v0.0.20 | Added `new_reader_memory` | +| v0.0.5 | Initial release |