RunMat
GitHub

unzip — Extract files from ZIP archives in MATLAB and RunMat.

unzip(zipfilename) extracts a ZIP archive into the current folder. unzip(zipfilename, outputfolder) extracts into the requested destination folder. The first argument can be a local file path or an HTTP/HTTPS URL, and filenames = unzip(...) returns a cell array of extracted file paths.

Syntax

unzip(zipfilename)
unzip(zipfilename, outputfolder)
filenames = unzip(___)

Inputs

NameTypeRequiredDefaultDescription
zipfilenameStringScalarYesZIP archive path or HTTP/HTTPS URL.
outputfolderStringScalarYesDestination folder for extracted files.

Returns

NameTypeDescription
filenamesAnyCell array of extracted file paths.

Returned values from unzip depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:unzip:InvalidArgumentArguments do not match supported unzip invocation forms.unzip: invalid argument
RunMat:unzip:FilenameZIP filename or URL is invalid.unzip: invalid ZIP filename
RunMat:unzip:OutputFolderOutput folder is invalid or cannot be created.unzip: invalid output folder

How unzip works

  • unzip(zipfilename) extracts all non-directory entries into the current working folder.
  • unzip(zipfilename, outputfolder) creates outputfolder when needed and extracts all entries beneath that folder.
  • unzip(url, outputfolder) downloads the archive over HTTP or HTTPS using RunMat's shared HTTP transport, then extracts it.
  • Returned filenames are a column cell array of character paths for regular files that were extracted. Directory entries are created as needed but are not included in the returned list.
  • Archive entries with absolute paths, user-relative paths, drive-prefixed names, or .. parent traversal are rejected before writing, preventing zip-slip extraction outside the destination folder.
  • Remote ZIP downloads are capped before extraction, and extracted bytes are counted while streaming each entry so malformed archives cannot grow without bound.
  • ZIP entries compressed with the standard deflate method are supported. Unsupported or malformed ZIP archives raise a RunMat:unzip:Zip diagnostic.
  • unzip is a host I/O sink. It suppresses statement-form auto output, and when called with zero requested outputs it still extracts files but returns no value.

Does RunMat run unzip on the GPU?

unzip is registered as a host I/O operation. Fusion groups terminate before archive extraction and no Accelerate provider hooks are used.

GPU memory and residency

No manual action is required. Path arguments are gathered to host values and extraction writes host filesystem files.

Examples

Extract into the current folder

unzip('sampleData.zip')

Extract into a specific output folder

files = unzip('sampleData.zip', 'data')

Download and extract a ZIP archive

files = unzip('https://example.com/sampleData.zip', tempdir)

Use the returned file list

files = unzip('measurements.zip', 'measurements');
firstFile = files{1};

Using unzip with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how unzip changes the result.

Run a small unzip example, explain the result, then change one input and compare the output.

FAQ

Does unzip create the destination folder?

Yes. The output folder and any archive subfolders are created when needed.

Can unzip extract archives from URLs?

Yes. HTTP and HTTPS URLs are downloaded with RunMat's shared HTTP transport before extraction.

Are directory entries returned in filenames?

No. Directory entries are created, but the returned cell array contains regular extracted file paths.

How are unsafe ZIP paths handled?

RunMat rejects entries that would escape the destination folder, including absolute paths, .. traversal, drive-prefixed names, and user-relative paths.

Does unzip run on the GPU?

No. Archive extraction is filesystem and network I/O, so it always runs on the host.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how unzip is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.