Archive
Archive Extraction Module
Unified archive extraction for ZIP and TAR.GZ formats.
Provides format detection, extraction, and cleanup utilities for archive files.
Interfaces
DiscoveredExtension
Defined in: packages/core/src/archive/extract.ts:140
Information about a discovered extension in an archive.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
id |
object |
Extension ID derived from directory structure. | packages/core/src/archive/extract.ts:146 |
id.name |
string |
- | packages/core/src/archive/extract.ts:146 |
id.owner |
string | null |
- | packages/core/src/archive/extract.ts:146 |
path |
string |
Absolute path to the extension root (directory containing _extension.yml). | packages/core/src/archive/extract.ts:142 |
relativePath |
string |
Path relative to the extraction root (for display purposes). | packages/core/src/archive/extract.ts:144 |
ExtractOptions
Defined in: packages/core/src/archive/extract.ts:20
Options for archive extraction.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
maxSize? |
number |
Maximum total extraction size in bytes. | packages/core/src/archive/extract.ts:22 |
onProgress? |
(file) => void |
Progress callback. | packages/core/src/archive/extract.ts:24 |
ExtractResult
Defined in: packages/core/src/archive/extract.ts:30
Result of archive extraction.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
extractDir |
string |
Path to the extraction directory. | packages/core/src/archive/extract.ts:32 |
files |
string[] |
List of extracted file paths. | packages/core/src/archive/extract.ts:34 |
format |
"zip" | "tarball" |
Detected archive format. | packages/core/src/archive/extract.ts:36 |
Functions
cleanupExtraction()
TypeScript
function cleanupExtraction(extractDir): Promise<void>;Defined in: packages/core/src/archive/extract.ts:221
Clean up a temporary extraction directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
extractDir |
string |
Directory to remove |
Returns
Promise<void>
detectArchiveFormat()
TypeScript
function detectArchiveFormat(archivePath): "zip" | "tarball" | null;Defined in: packages/core/src/archive/extract.ts:42
Detect archive format from file path.
Parameters
| Parameter | Type |
|---|---|
archivePath |
string |
Returns
"zip" | "tarball" | null
extractArchive()
TypeScript
function extractArchive(archivePath, options): Promise<ExtractResult>;Defined in: packages/core/src/archive/extract.ts:63
Extract an archive to a temporary directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
archivePath |
string |
Path to the archive file |
options |
ExtractOptions |
Extraction options |
Returns
Promise<ExtractResult>
Extraction result
findAllExtensionRoots()
TypeScript
function findAllExtensionRoots(extractDir): Promise<DiscoveredExtension[]>;Defined in: packages/core/src/archive/extract.ts:185
Find all extension roots in an extracted archive.
Unlike findExtensionRoot which returns the first match, this function finds all extensions in the archive, useful for repositories that contain multiple extensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
extractDir |
string |
Extraction directory |
Returns
Promise<<code><a href="#discoveredextension" style="text-decoration-line: underline; text-decoration-style: dashed; text-decoration-thickness: 1px; text-decoration-color: currentColor;">DiscoveredExtension</a>[]</code>{=html}>
Array of discovered extensions
findExtensionRoot()
TypeScript
function findExtensionRoot(extractDir): Promise<string | null>;Defined in: packages/core/src/archive/extract.ts:103
Find the extension root in an extracted archive.
GitHub archives typically have a top-level directory like “repo-tag/”. This function finds the directory containing _extension.yml.
Parameters
| Parameter | Type | Description |
|---|---|---|
extractDir |
string |
Extraction directory |
Returns
Promise<string | null>
Path to extension root or null if not found
TAR.GZ Archive Extraction Module
TAR.GZ archive extraction with security checks.
Includes protection against path traversal and oversized archives.
Interfaces
TarExtractOptions
Defined in: packages/core/src/archive/tar.ts:21
Options for TAR extraction.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
maxSize? |
number |
Maximum total extraction size in bytes. | packages/core/src/archive/tar.ts:23 |
onProgress? |
(file) => void |
Progress callback. | packages/core/src/archive/tar.ts:25 |
Functions
extractTar()
TypeScript
function extractTar(
archivePath,
destDir,
options): Promise<string[]>;Defined in: packages/core/src/archive/tar.ts:47
Extract a TAR.GZ archive to a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
archivePath |
string |
Path to the TAR.GZ file |
destDir |
string |
Destination directory |
options |
TarExtractOptions |
Extraction options |
Returns
Promise<string[]>
List of extracted file paths
ZIP Archive Extraction Module
ZIP archive extraction with security checks.
Includes protection against path traversal and zip bomb attacks.
Interfaces
ZipExtractOptions
Defined in: packages/core/src/archive/zip.ts:24
Options for ZIP extraction.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
maxSize? |
number |
Maximum total extraction size in bytes. | packages/core/src/archive/zip.ts:26 |
onProgress? |
(file) => void |
Progress callback. | packages/core/src/archive/zip.ts:28 |
Functions
extractZip()
TypeScript
function extractZip(
archivePath,
destDir,
options): Promise<string[]>;Defined in: packages/core/src/archive/zip.ts:50
Extract a ZIP archive to a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
archivePath |
string |
Path to the ZIP file |
destDir |
string |
Destination directory |
options |
ZipExtractOptions |
Extraction options |
Returns
Promise<string[]>
List of extracted file paths