gdal vsi sozip
Added in version 3.11.
SOZIP (Seek-Optimized ZIP) related commands
Description
The gdal vsi 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 into a SOZip optimized one
Synopsis
Usage: gdal vsi sozip <SUBCOMMAND> [OPTIONS]
where <SUBCOMMAND> is one of:
- create: Create a Seek-optimized ZIP (SOZIP) file.
- list: List content of a ZIP file, with SOZIP related information.
- optimize: Create a Seek-optimized ZIP (SOZIP) file from a regular ZIP file.
- validate: Validate a ZIP file, possibly using SOZIP optimization.
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
"gdal vsi sozip create"
Description
Adds one or several files to a new or existing zip file.
Synopsis
Usage: gdal vsi sozip create [OPTIONS] <INPUT> <OUTPUT>
Create a Seek-optimized ZIP (SOZIP) file.
Positional arguments:
-i, --input <INPUT> Input filenames [may be repeated] [required]
-o, --output <OUTPUT> Output ZIP filename [required]
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
--progress Display progress bar
Options:
--overwrite Whether overwriting existing output is allowed
-r, --recursive Travels the directory structure of the specified directories recursively
-j, --junk-paths, --no-paths Store just the name of a saved file, and do not store directory names
--enable-sozip <ENABLE-SOZIP> Whether to automatically/systematically/never apply the SOZIP optimization. ENABLE-SOZIP=auto|yes|no (default: auto)
--sozip-chunk-size <value in bytes or with K/M suffix> Chunk size for a seek-optimized file (default: 32768)
--sozip-min-file-size <value in bytes or with K/M/G suffix> Minimum file size to decide if a file should be seek-optimized (default: 1 MB)
--content-type <CONTENT-TYPE> Store the Content-Type of the file being added.
-q, --quiet Quiet mode
Options
- -i, --input <INPUT>
Input filenames. Required. Several file names or directory names accepted.
- -o, --output <OUTPUT>
Output ZIP filename. Required. Must have a
.zip
extension
- --overwrite
Whether overwriting existing output is allowed.
- -r, --recursive
Travels the directory structure of the specified directories recursively.
- -j, --junk-paths, --no-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).
- --enable-sozip auto|yes|no
In
auto
mode, a file is seek-optimized only if its size is above the value of--sozip-min-file-size
. Inyes
mode, all input files will be seek-optimized. Inno
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
andM
suffix (optionally preceded by a space) 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
orG
suffix (optionally preceded by a space) 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
- -q, --quiet
Do not output any informative message (only errors).
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
.
Examples
Example 1: Create a, potentially seek-optimized, ZIP file with the content of my.gpkg
gdal vsi sozip create my.gpkg my.gpkg.zip
Example 2: Create a, potentially seek-optimized, ZIP file from the content of a source directory:
gdal vsi sozip create -r source_dir/ my.gpkg.zip
"gdal vsi sozip optimize"
Description
Create a new zip file from the content of an existing one, possibly applying SOZip optimization when relevant.
Synopsis
Usage: gdal vsi sozip optimize [OPTIONS] <INPUT> <OUTPUT>
Create a Seek-optimized ZIP (SOZIP) file from a regular ZIP file.
Positional arguments:
-i, --input <INPUT> Input ZIP filename [required]
-o, --output <OUTPUT> Output ZIP filename [required]
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
--progress Display progress bar
Options:
--overwrite Whether overwriting existing output is allowed
--enable-sozip <ENABLE-SOZIP> Whether to automatically/systematically/never apply the SOZIP optimization. ENABLE-SOZIP=auto|yes|no (default: auto)
--sozip-chunk-size <value in bytes or with K/M suffix> Chunk size for a seek-optimized file (default: 32768)
--sozip-min-file-size <value in bytes or with K/M/G suffix> Minimum file size to decide if a file should be seek-optimized (default: 1 MB)
-q, --quiet Quiet mode
Options
- -i, --input <INPUT>
Input ZIP filename. Required.
- -o, --output <OUTPUT>
Output ZIP filename. Required. Must have a
.zip
extension
- --overwrite
Whether overwriting existing output is allowed.
- --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
. Inyes
mode, all input files will be seek-optimized. Inno
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.
- -q, --quiet
Do not output any informative message (only errors).
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
.
Examples
Example 3: Create a, potentially seek-optimized, ZIP file sozip_optimized.zip
from an existing ZIP file in.zip
.
gdal vsi sozip optimize in.zip sozip_optimized.zip
"gdal vsi sozip list"
Description
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.
Synopsis
Usage: gdal vsi sozip list [OPTIONS] <INPUT>
List content of a ZIP file, with SOZIP related information.
Positional arguments:
-i, --input <INPUT> Input ZIP filename [required]
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
Options
- -i, --input <INPUT>
Input ZIP filename. Required.
Examples
Example 4: List contents of my.zip
.
gdal vsi sozip list my.zip
"gdal vsi sozip validate"
Description
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.
Synopsis
Usage: gdal vsi sozip list [OPTIONS] <INPUT>
List content of a ZIP file, with SOZIP related information.
Positional arguments:
-i, --input <INPUT> Input ZIP filename [required]
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
Options
- -i, --input <INPUT>
Input ZIP filename. Required.
- -q, --quiet
Do not output any informative message (only errors).
- -v, --verbose
Turn on verbose mode.
Examples
Example 5: Validate my.zip
.
gdal vsi sozip validate my.zip