Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions docs/references/api/bindings/miniz.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -377,15 +377,43 @@ 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.
:::

Returns `nil` and an error message in case of failure. Otherwise the ZIP [reader](#ZipFileReader) should be ready to use.

<Function>
<Parameters>
<Parameter name="fileSystemPath" type="string"/>
<Parameter name="flags" type="number" optional/>
</Parameters>
<Returns>
<Return name="reader" type="ZipFileReader"/>
<Return name="reader" type="ZipFileReader" optional/>
<Return name="errorMessage" type="string" optional/>
</Returns>
</Function>

### 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. 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.
:::

Returns `nil` and an error message in case of failure. Otherwise the ZIP [reader](#ZipFileReader) should be ready to use.

<Function>
<Parameters>
<Parameter name="fileContents" type="string"/>
<Parameter name="flags" type="number" optional/>
</Parameters>
<Returns>
<Return name="reader" type="ZipFileReader" optional/>
<Return name="errorMessage" type="string" optional/>
</Returns>
</Function>

Expand Down Expand Up @@ -443,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 |