Skip to content

Extracts `.7z` archives. It can only decompress; there is no function to create a 7z archive (use `Zip` or `Tar` for that).

Functions

  • decompress self Extracts a `.7z` archive into a directory.
SevenZip.decompress(in: string, destination: string)→self

Extracts a `.7z` archive into a directory. Directories are created as needed; empty directories in the archive are not recreated, and existing files are overwritten. Entries are streamed to disk. Like `Zip.extract` and `Tar.extract`, an entry whose path would end up outside the destination (for example `../x`, or through a symbolic link) aborts the extraction with an error. Throws an error with the reason when the archive is missing or not a valid 7z file; entries extracted before an error stay on disk.

Parameters

in string
7z file to extract, relative to the workspace
destination string
Directory to extract into, relative to the workspace

Returns

self chainable The library itself, so calls can be chained.

Example

SevenZip.decompress("archive.7z", "extracted")