sozip

Added in version 3.7.

Generate a seek-optimized ZIP (SOZip) file.

Synopsis

sozip [--help] [--help-general]
      [--quiet|--verbose]
      [[-g|--grow] | [--overwrite]]
      [-r|--recurse-paths]
      [-j|--junk-paths]
      [-l|--list]
      [--optimize-from=<input.zip>]
      [--validate]
      [--enable-sozip={auto|yes|no}]
      [--sozip-chunk-size=<value>]
      [--sozip-min-file-size=<value>]
      [--content-type=<value>]
      <zip_filename> [<filename>]...

Description

The sozip utility can be used to:

  • create a SOZip (Seek-Optimized ZIP) file

  • append files to an existing ZIP/SOZip file

  • list the contents of a ZIP/SOZip file

  • validate a SOZip file

  • convert an existing Zip file in a SOZip optimized one

--help

Show this help message and exit

--help-general

Gives a brief usage message for the generic GDAL commandline options and exit.

--quiet

Quiet mode. No progress message is emitted on the standard output.

--verbose

Verbose mode.

-g
--grow

Grow an existing zip file with the content of the specified filename(s). This is the default mode of the utility. This switch is here for compatibility with Info-ZIP zip utility

--overwrite

Overwrite the target zip file if it already exists.

-l
--list

List the files contained in the zip file in an output similar to Info-ZIP unzip utility, but with the addition of a column indicating whether each file is seek-optimized.

--validate

Validates a SOZip file. Baseline ZIP validation is done in a light way, limited to being able to browse through ZIP records with the InfoZIP-based ZIP reader used by GDAL. But validation of the SOZip-specific aspects is done in a more thorougful way.

-r
--recurse-paths

Travels the directory structure of the specified directory/directories recursively.

-j
--junk-paths

Store just the name of a saved file (junk the path), and do not store directory names. By default, sozip will store the full path (relative to the current directory).

--optimize-from=<input.zip>

Re-process {input.zip} to generate a SOZip-optimized .zip. Options --enable-sozip, --sozip-chunk-size and --sozip-min-file-size may be used in that mode.

--enable-sozip={auto|yes|no}

In auto mode, a file is seek-optimized only if its size is above the value of --sozip-chunk-size. In yes mode, all input files will be seek-optimized. In no mode, no input files will be seek-optimized.

--sozip-chunk-size=<value>

Chunk size for a seek-optimized file. Defaults to 32768 bytes. The value is specified in bytes, or K and M suffix can be respectively used to specify a value in kilo-bytes or mega-bytes.

--sozip-min-file-size=<value>

Minimum file size to decide if a file should be seek-optimized, in --enable-sozip=auto mode. Defaults to 1 MB byte. The value is specified in bytes, or K, M or G suffix can be respectively used to specify a value in kilo-bytes, mega-bytes or giga-bytes.

--content-type=<value>

Store the Content-Type for the file being added as a key-value pair in the extra field extension 'KV' (0x564b) dedicated to storing key-value pair metadata

<zip_filename>

Filename of the zip file to create/append to/list.

<filename>

Filename of the file to add.

Multithreading

The GDAL_NUM_THREADS configuration option can be set to ALL_CPUS or a integer value to specify the number of threads to use for SOZip-compressed files. Defaults to ALL_CPUS.

C API

Functionality of this utility can be done from C with CPLAddFileInZip() or VSICopyFile().

Examples

Create a, potentially seek-optimized, ZIP file with the content of my.gpkg:

sozip my.gpkg.zip my.gpkg

Create a, potentially seek-optimized, ZIP file from the content of a source directory:

sozip -r my.gpkg.zip source_dir/

Create a, potentially seek-optimized, ZIP file from an existing ZIP file.

sozip --convert-from=in.zip out.zip

List the contents of a ZIP file and display which files are seek-optimized:

sozip -l my.gpkg.zip

Validates a SOZip file:

sozip --validate my.gpkg.zip