l0.DependencyControl.ZipArchiver¶
ZipArchiver ¶
Builds zip archives using each platform's stock tooling — no extra rocks or shared libraries to install or locate. Files are added with explicit, forward-slash entry names so the resulting archives extract correctly on every platform. Compression only for now; reading/extraction can be added when needed.
archiver = ZipArchiver outputPath
archiver\addDirectory distDir
archiver\addFile readmePath, "README.md"
success, err = archiver\write!
Constructor ¶
Creates an archiver that will write a zip to outputPath.
| param | type | description |
|---|---|---|
| outputPath | string |
Absolute path of the archive to create. |
| logger? | Logger |
Instance methods¶
addFile ¶
Adds a single file under archiveName (a forward-slash path within the archive).
| param | type | description |
|---|---|---|
| sourcePath | string |
Absolute path of the file to add. |
| archiveName | string |
Name/path the file should have inside the archive. |
Returns:
selfZipArchiver — for chaining.
addDirectory ¶
Adds every file beneath sourceDir, naming each entry by its path relative to
sourceDir (optionally below archivePrefix).
| param | type | description |
|---|---|---|
| sourceDir | string |
Absolute path of the directory to add. |
| archivePrefix? | string |
Optional path prefix for the entries inside the archive. |
Returns:
selfZipArchiver — for chaining.
write ¶
Writes the archive to outputPath. Returns true on success, or nil plus an
error message.
Returns:
successboolean|nilerrstring|nil