Skip to main content

@terascope/core-utils / unzip

unzip

Functions​

unzip()​

unzip(zipFilePath, destDir): Promise<void>

Defined in: packages/core-utils/src/unzip.ts:18

Extract a zip file on disk into destDir, streaming one entry at a time so peak memory stays at a single entry instead of the whole archive.

yauzl handles the scary parts by default: it rejects zip-slip paths (.., absolute, drive-letter, backslash) via validateFileName, and verifies each entry's uncompressed size against its header (zip-bomb) while piping. On top of that we create implicit parent dirs, preserve unix permissions so executables stay executable, and refuse symlink entries.

Parameters​

ParameterType
zipFilePathstring
destDirstring

Returns​

Promise<void>