zip
Reads and writes ZIP archives.
The API is VFS-transparent: archive paths use the active VFS context.
Types
| Type | Description |
|---|---|
Archive |
An open ZIP archive. |
Entry |
A single archive entry's metadata, with a method to open it for reading. |
File |
An open file within a ZIP archive. |
OpenMode |
Access mode accepted by open. |
OpenMode = ("r" | "w")
Access mode accepted by open.
| Mode | Description |
|---|---|
"r" |
Read mode -- opens an existing archive for reading |
"w" |
Write mode -- creates a new archive, truncating any existing one |
Functions
open path … -> Archive
Opens a ZIP archive.
The archive stays open until Archive.close is called.
Parameters
| Name | Type | Description |
|---|---|---|
path |
(Str | fs.Path) |
Path to the ZIP archive file. |
mode? |
OpenMode |
Access mode. Defaults to "r". |
open[R] path func -> R
Opens a ZIP archive for reading and calls func with it. The archive is
closed when func returns.
Parameters
| Name | Type | Description |
|---|---|---|
path |
(Str | fs.Path) |
Path to the ZIP archive file. |
func |
((Archive) -> R) |
Called with the Archive. |
open[R] path mode func -> R
Opens a ZIP archive with a mode and calls func with it. The archive is
closed when func returns.
Parameters
| Name | Type | Description |
|---|---|---|
path |
(Str | fs.Path) |
Path to the ZIP archive file. |
mode |
OpenMode |
Access mode. |
func |
((Archive) -> R) |
Called with the Archive. |