Skip to main content

Fetch a Zip Archive and Scan Extract

ZIP archives can be remotely fetched via the api command for entry metadata scanning and extraction/conversion to datasets.

Specific file entries can be extracted and automatically serialized into datasets.

Let's take a look at an example.

Example​

Full Query​

api get http://featureblend.com/static/zip_example.zip
|| api get http://featureblend.com/static/zip_example.zip --unzip.path $path$

Stage 1: Open and scan a Zip file entries​

api get http://featureblend.com/static/zip_example.zip

The first stage will scan a Zip file and return a list of internal file entries metadata. Metadata includes specific information about each file found in a Zip archive including its name, path, size and other goodies. The Zip file metadata does not include the decompressed content.

Stage 2: Extract and convert files into a merged dataset​

...
|| api get http://featureblend.com/static/zip_example.zip --unzip.path $path$

With our list of zip file entries, we will use the api command with a $path$ token to pluck the item value from each row. The $path$ token will be used to construct the --unzip.path value that will automatically extract and serialize the specified file contents into a dataset.

NOTE: The automagic serialization of the contents of a file into a dataset is derived from it's file extension.