change command name to --filelist=
updated documentation and man page
This commit is contained in:
parent
a78a8759a2
commit
d7f258d845
145
programs/zstd.1
145
programs/zstd.1
@ -95,120 +95,97 @@ Display information related to a zstd compressed file, such as size, ratio, and
|
||||
.
|
||||
.SS "Operation modifiers"
|
||||
.
|
||||
.TP
|
||||
\fB\-#\fR
|
||||
\fB#\fR compression level [1\-19] (default: 3)
|
||||
.IP "\(bu" 4
|
||||
\fB\-#\fR: \fB#\fR compression level [1\-19] (default: 3)
|
||||
.
|
||||
.TP
|
||||
\fB\-\-fast[=#]\fR
|
||||
switch to ultra\-fast compression levels\. If \fB=#\fR is not present, it defaults to \fB1\fR\. The higher the value, the faster the compression speed, at the cost of some compression ratio\. This setting overwrites compression level if one was set previously\. Similarly, if a compression level is set after \fB\-\-fast\fR, it overrides it\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-fast[=#]\fR: switch to ultra\-fast compression levels\. If \fB=#\fR is not present, it defaults to \fB1\fR\. The higher the value, the faster the compression speed, at the cost of some compression ratio\. This setting overwrites compression level if one was set previously\. Similarly, if a compression level is set after \fB\-\-fast\fR, it overrides it\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-ultra\fR
|
||||
unlocks high compression levels 20+ (maximum 22), using a lot more memory\. Note that decompression will also require more memory when using these levels\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-ultra\fR: unlocks high compression levels 20+ (maximum 22), using a lot more memory\. Note that decompression will also require more memory when using these levels\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-long[=#]\fR
|
||||
enables long distance matching with \fB#\fR \fBwindowLog\fR, if not \fB#\fR is not present it defaults to \fB27\fR\. This increases the window size (\fBwindowLog\fR) and memory usage for both the compressor and decompressor\. This setting is designed to improve the compression ratio for files with long matches at a large distance\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-long[=#]\fR: enables long distance matching with \fB#\fR \fBwindowLog\fR, if not \fB#\fR is not present it defaults to \fB27\fR\. This increases the window size (\fBwindowLog\fR) and memory usage for both the compressor and decompressor\. This setting is designed to improve the compression ratio for files with long matches at a large distance\.
|
||||
.
|
||||
.IP
|
||||
Note: If \fBwindowLog\fR is set to larger than 27, \fB\-\-long=windowLog\fR or \fB\-\-memory=windowSize\fR needs to be passed to the decompressor\.
|
||||
.
|
||||
.TP
|
||||
\fB\-T#\fR, \fB\-\-threads=#\fR
|
||||
Compress using \fB#\fR working threads (default: 1)\. If \fB#\fR is 0, attempt to detect and use the number of physical CPU cores\. In all cases, the nb of threads is capped to ZSTDMT_NBTHREADS_MAX==200\. This modifier does nothing if \fBzstd\fR is compiled without multithread support\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-T#\fR, \fB\-\-threads=#\fR: Compress using \fB#\fR working threads (default: 1)\. If \fB#\fR is 0, attempt to detect and use the number of physical CPU cores\. In all cases, the nb of threads is capped to ZSTDMT_NBTHREADS_MAX==200\. This modifier does nothing if \fBzstd\fR is compiled without multithread support\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-single\-thread\fR
|
||||
Does not spawn a thread for compression, use a single thread for both I/O and compression\. In this mode, compression is serialized with I/O, which is slightly slower\. (This is different from \fB\-T1\fR, which spawns 1 compression thread in parallel of I/O)\. This mode is the only one available when multithread support is disabled\. Single\-thread mode features lower memory usage\. Final compressed result is slightly different from \fB\-T1\fR\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-single\-thread\fR: Does not spawn a thread for compression, use a single thread for both I/O and compression\. In this mode, compression is serialized with I/O, which is slightly slower\. (This is different from \fB\-T1\fR, which spawns 1 compression thread in parallel of I/O)\. This mode is the only one available when multithread support is disabled\. Single\-thread mode features lower memory usage\. Final compressed result is slightly different from \fB\-T1\fR\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-adapt[=min=#,max=#]\fR
|
||||
\fBzstd\fR will dynamically adapt compression level to perceived I/O conditions\. Compression level adaptation can be observed live by using command \fB\-v\fR\. Adaptation can be constrained between supplied \fBmin\fR and \fBmax\fR levels\. The feature works when combined with multi\-threading and \fB\-\-long\fR mode\. It does not work with \fB\-\-single\-thread\fR\. It sets window size to 8 MB by default (can be changed manually, see \fBwlog\fR)\. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible\. \fInote\fR : at the time of this writing, \fB\-\-adapt\fR can remain stuck at low speed when combined with multiple worker threads (>=2)\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-adapt[=min=#,max=#]\fR : \fBzstd\fR will dynamically adapt compression level to perceived I/O conditions\. Compression level adaptation can be observed live by using command \fB\-v\fR\. Adaptation can be constrained between supplied \fBmin\fR and \fBmax\fR levels\. The feature works when combined with multi\-threading and \fB\-\-long\fR mode\. It does not work with \fB\-\-single\-thread\fR\. It sets window size to 8 MB by default (can be changed manually, see \fBwlog\fR)\. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible\. \fInote\fR : at the time of this writing, \fB\-\-adapt\fR can remain stuck at low speed when combined with multiple worker threads (>=2)\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-stream\-size=#\fR
|
||||
Sets the pledged source size of input coming from a stream\. This value must be exact, as it will be included in the produced frame header\. Incorrect stream sizes will cause an error\. This information will be used to better optimize compression parameters, resulting in better and potentially faster compression, especially for smaller source sizes\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-stream\-size=#\fR : Sets the pledged source size of input coming from a stream\. This value must be exact, as it will be included in the produced frame header\. Incorrect stream sizes will cause an error\. This information will be used to better optimize compression parameters, resulting in better and potentially faster compression, especially for smaller source sizes\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-size\-hint=#\fR
|
||||
When handling input from a stream, \fBzstd\fR must guess how large the source size will be when optimizing compression parameters\. If the stream size is relatively small, this guess may be a poor one, resulting in a higher compression ratio than expected\. This feature allows for controlling the guess when needed\. Exact guesses result in better compression ratios\. Overestimates result in slightly degraded compression ratios, while underestimates may result in significant degradation\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-size\-hint=#\fR: When handling input from a stream, \fBzstd\fR must guess how large the source size will be when optimizing compression parameters\. If the stream size is relatively small, this guess may be a poor one, resulting in a higher compression ratio than expected\. This feature allows for controlling the guess when needed\. Exact guesses result in better compression ratios\. Overestimates result in slightly degraded compression ratios, while underestimates may result in significant degradation\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-rsyncable\fR
|
||||
\fBzstd\fR will periodically synchronize the compression state to make the compressed file more rsync\-friendly\. There is a negligible impact to compression ratio, and the faster compression levels will see a small compression speed hit\. This feature does not work with \fB\-\-single\-thread\fR\. You probably don\'t want to use it with long range mode, since it will decrease the effectiveness of the synchronization points, but your milage may vary\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-rsyncable\fR : \fBzstd\fR will periodically synchronize the compression state to make the compressed file more rsync\-friendly\. There is a negligible impact to compression ratio, and the faster compression levels will see a small compression speed hit\. This feature does not work with \fB\-\-single\-thread\fR\. You probably don\'t want to use it with long range mode, since it will decrease the effectiveness of the synchronization points, but your milage may vary\.
|
||||
.
|
||||
.TP
|
||||
\fB\-D file\fR
|
||||
use \fBfile\fR as Dictionary to compress or decompress FILE(s)
|
||||
.IP "\(bu" 4
|
||||
\fB\-D file\fR: use \fBfile\fR as Dictionary to compress or decompress FILE(s)
|
||||
.
|
||||
.TP
|
||||
\fB\-\-no\-dictID\fR
|
||||
do not store dictionary ID within frame header (dictionary compression)\. The decoder will have to rely on implicit knowledge about which dictionary to use, it won\'t be able to check if it\'s correct\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-no\-dictID\fR: do not store dictionary ID within frame header (dictionary compression)\. The decoder will have to rely on implicit knowledge about which dictionary to use, it won\'t be able to check if it\'s correct\.
|
||||
.
|
||||
.TP
|
||||
\fB\-o file\fR
|
||||
save result into \fBfile\fR (only possible with a single \fIINPUT\-FILE\fR)
|
||||
.IP "\(bu" 4
|
||||
\fB\-o file\fR: save result into \fBfile\fR (only possible with a single \fIINPUT\-FILE\fR)
|
||||
.
|
||||
.TP
|
||||
\fB\-f\fR, \fB\-\-force\fR
|
||||
overwrite output without prompting, and (de)compress symbolic links
|
||||
.IP "\(bu" 4
|
||||
\fB\-f\fR, \fB\-\-force\fR: overwrite output without prompting, and (de)compress symbolic links
|
||||
.
|
||||
.TP
|
||||
\fB\-c\fR, \fB\-\-stdout\fR
|
||||
force write to standard output, even if it is the console
|
||||
.IP "\(bu" 4
|
||||
\fB\-c\fR, \fB\-\-stdout\fR: force write to standard output, even if it is the console
|
||||
.
|
||||
.TP
|
||||
\fB\-\-[no\-]sparse\fR
|
||||
enable / disable sparse FS support, to make files with many zeroes smaller on disk\. Creating sparse files may save disk space and speed up decompression by reducing the amount of disk I/O\. default: enabled when output is into a file, and disabled when output is stdout\. This setting overrides default and can force sparse mode over stdout\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-[no\-]sparse\fR: enable / disable sparse FS support, to make files with many zeroes smaller on disk\. Creating sparse files may save disk space and speed up decompression by reducing the amount of disk I/O\. default: enabled when output is into a file, and disabled when output is stdout\. This setting overrides default and can force sparse mode over stdout\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-rm\fR
|
||||
remove source file(s) after successful compression or decompression
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-rm\fR: remove source file(s) after successful compression or decompression
|
||||
.
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-keep\fR
|
||||
keep source file(s) after successful compression or decompression\. This is the default behavior\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-k\fR, \fB\-\-keep\fR: keep source file(s) after successful compression or decompression\. This is the default behavior\.
|
||||
.
|
||||
.TP
|
||||
\fB\-r\fR
|
||||
operate recursively on directories
|
||||
.IP "\(bu" 4
|
||||
\fB\-r\fR: operate recursively on directories
|
||||
.
|
||||
.TP
|
||||
\fB\-\-output\-dir\-flat[=dir]\fR
|
||||
resulting files are stored into target \fBdir\fR directory, instead of same directory as origin file\. Be aware that this command can introduce name collision issues, if multiple files, from different directories, end up having the same name\. Collision resolution ensures first file with a given name will be present in \fBdir\fR, while in combination with \fB\-f\fR, the last file will be present instead\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-filelist=FILE\fR read a list of files to process as content from \fBFILE\fR\. Format is compatible with \fBls\fR output, with one file per file\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-format=FORMAT\fR
|
||||
compress and decompress in other formats\. If compiled with support, zstd can compress to or decompress from other compression algorithm formats\. Possibly available options are \fBzstd\fR, \fBgzip\fR, \fBxz\fR, \fBlzma\fR, and \fBlz4\fR\. If no such format is provided, \fBzstd\fR is the default\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-output\-dir\-flat[=dir]\fR: resulting files are stored into target \fBdir\fR directory, instead of same directory as origin file\. Be aware that this command can introduce name collision issues, if multiple files, from different directories, end up having the same name\. Collision resolution ensures first file with a given name will be present in \fBdir\fR, while in combination with \fB\-f\fR, the last file will be present instead\.
|
||||
.
|
||||
.TP
|
||||
\fB\-h\fR/\fB\-H\fR, \fB\-\-help\fR
|
||||
display help/long help and exit
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-format=FORMAT\fR: compress and decompress in other formats\. If compiled with support, zstd can compress to or decompress from other compression algorithm formats\. Possibly available options are \fBzstd\fR, \fBgzip\fR, \fBxz\fR, \fBlzma\fR, and \fBlz4\fR\. If no such format is provided, \fBzstd\fR is the default\.
|
||||
.
|
||||
.TP
|
||||
\fB\-V\fR, \fB\-\-version\fR
|
||||
display version number and exit\. Advanced : \fB\-vV\fR also displays supported formats\. \fB\-vvV\fR also displays POSIX support\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-h\fR/\fB\-H\fR, \fB\-\-help\fR: display help/long help and exit
|
||||
.
|
||||
.TP
|
||||
\fB\-v\fR
|
||||
verbose mode
|
||||
.IP "\(bu" 4
|
||||
\fB\-V\fR, \fB\-\-version\fR: display version number and exit\. Advanced : \fB\-vV\fR also displays supported formats\. \fB\-vvV\fR also displays POSIX support\.
|
||||
.
|
||||
.TP
|
||||
\fB\-q\fR, \fB\-\-quiet\fR
|
||||
suppress warnings, interactivity, and notifications\. specify twice to suppress errors too\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-v\fR: verbose mode
|
||||
.
|
||||
.TP
|
||||
\fB\-\-no\-progress\fR
|
||||
do not display the progress bar, but keep all other messages\.
|
||||
.IP "\(bu" 4
|
||||
\fB\-q\fR, \fB\-\-quiet\fR: suppress warnings, interactivity, and notifications\. specify twice to suppress errors too\.
|
||||
.
|
||||
.TP
|
||||
\fB\-C\fR, \fB\-\-[no\-]check\fR
|
||||
add integrity check computed from uncompressed data (default: enabled)
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-no\-progress\fR: do not display the progress bar, but keep all other messages\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-\fR
|
||||
All arguments after \fB\-\-\fR are treated as files
|
||||
.IP "\(bu" 4
|
||||
\fB\-C\fR, \fB\-\-[no\-]check\fR: add integrity check computed from uncompressed data (default: enabled)
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fB\-\-\fR: All arguments after \fB\-\-\fR are treated as files
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.SS "Restricted usage of Environment Variables"
|
||||
Using environment variables to set parameters has security implications\. Therefore, this avenue is intentionally restricted\. Only \fBZSTD_CLEVEL\fR is supported currently, for setting compression level\. \fBZSTD_CLEVEL\fR can be used to set the level between 1 and 19 (the "normal" range)\. If the value of \fBZSTD_CLEVEL\fR is not a valid integer, it will be ignored with a warning message\. \fBZSTD_CLEVEL\fR just replaces the default compression level (\fB3\fR)\. It can be overridden by corresponding command line arguments\.
|
||||
|
@ -191,6 +191,9 @@ the last one takes effect.
|
||||
This is the default behavior.
|
||||
* `-r`:
|
||||
operate recursively on directories
|
||||
* `--filelist=FILE`
|
||||
read a list of files to process as content from `FILE`.
|
||||
Format is compatible with `ls` output, with one file per file.
|
||||
* `--output-dir-flat[=dir]`:
|
||||
resulting files are stored into target `dir` directory,
|
||||
instead of same directory as origin file.
|
||||
|
@ -154,7 +154,8 @@ static int usage_advanced(const char* programName)
|
||||
#endif
|
||||
#ifdef UTIL_HAS_CREATEFILELIST
|
||||
DISPLAY( " -r : operate recursively on directories \n");
|
||||
DISPLAY( "--output-dir-flat[=directory]: all resulting files stored into `directory`. \n");
|
||||
DISPLAY( "--filelist=FILE : read a list of files from FILE. \n");
|
||||
DISPLAY( "--output-dir-flat=DIR : all resulting files are stored into DIR. \n");
|
||||
#endif
|
||||
DISPLAY( "--format=zstd : compress files to the .zst format (default) \n");
|
||||
#ifdef ZSTD_GZCOMPRESS
|
||||
@ -798,7 +799,13 @@ int main(int argCount, const char* argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
if (longCommandWArg(&argument, "--file=")) {
|
||||
if (longCommandWArg(&argument, "--filelist=")) {
|
||||
/* note : in theory, it's better to just store the arguments at this stage,
|
||||
* and only start to load & interpret the file after command line is parsed.
|
||||
* For a single file, it would be easy to just store its name here, and parse later.
|
||||
* However, this implementation makes it possible to read multiple files.
|
||||
* An equivalent will have to be able to store multiple file names.
|
||||
*/
|
||||
FileNamesTable* extendedTable;
|
||||
FileNamesTable* curTable;
|
||||
FileNamesTable* concatenatedTables;
|
||||
|
@ -294,52 +294,52 @@ test -f tmpOutDirDecomp/tmp1
|
||||
rm -rf tmp*
|
||||
|
||||
|
||||
println "test : compress multiple files reading them from a file, --file=FILE"
|
||||
println "test : compress multiple files reading them from a file, --filelist=FILE"
|
||||
println "Hello world!, file1" > tmp1
|
||||
println "Hello world!, file2" > tmp2
|
||||
println tmp1 > tmp_fileList
|
||||
println tmp2 >> tmp_fileList
|
||||
$ZSTD -f --file=tmp_fileList
|
||||
$ZSTD -f --filelist=tmp_fileList
|
||||
test -f tmp2.zst
|
||||
test -f tmp1.zst
|
||||
rm -f *.zst
|
||||
|
||||
println "test : compress multiple files reading them from multiple files, --file=FILE"
|
||||
println "test : compress multiple files reading them from multiple files, --filelist=FILE"
|
||||
println "Hello world!, file3" > tmp3
|
||||
println "Hello world!, file4" > tmp4
|
||||
println tmp3 > tmp_fileList2
|
||||
println tmp4 >> tmp_fileList2
|
||||
$ZSTD -f --file=tmp_fileList --file=tmp_fileList2
|
||||
$ZSTD -f --filelist=tmp_fileList --filelist=tmp_fileList2
|
||||
test -f tmp1.zst
|
||||
test -f tmp2.zst
|
||||
test -f tmp3.zst
|
||||
test -f tmp4.zst
|
||||
|
||||
println "test : decompress multiple files reading them from a file, --file=FILE"
|
||||
println "test : decompress multiple files reading them from a file, --filelist=FILE"
|
||||
rm -f tmp1 tmp2
|
||||
println tmp1.zst > tmpZst
|
||||
println tmp2.zst >> tmpZst
|
||||
$ZSTD -d -f --file=tmpZst
|
||||
$ZSTD -d -f --filelist=tmpZst
|
||||
test -f tmp1
|
||||
test -f tmp2
|
||||
|
||||
println "test : decompress multiple files reading them from multiple files, --file=FILE"
|
||||
println "test : decompress multiple files reading them from multiple files, --filelist=FILE"
|
||||
rm -f tmp1 tmp2 tmp3 tmp4
|
||||
println tmp3.zst > tmpZst2
|
||||
println tmp4.zst >> tmpZst2
|
||||
$ZSTD -d -f --file=tmpZst --file=tmpZst2
|
||||
$ZSTD -d -f --filelist=tmpZst --filelist=tmpZst2
|
||||
test -f tmp1
|
||||
test -f tmp2
|
||||
test -f tmp3
|
||||
test -f tmp4
|
||||
|
||||
println "test : survive a list of files which is text garbage (--file=FILE)"
|
||||
println "test : survive a list of files which is text garbage (--filelist=FILE)"
|
||||
./datagen > tmp_badList
|
||||
$ZSTD -f --file=tmp_badList && die "should have failed : list is text garbage"
|
||||
$ZSTD -f --filelist=tmp_badList && die "should have failed : list is text garbage"
|
||||
|
||||
println "test : survive a list of files which is binary garbage (--file=FILE)"
|
||||
println "test : survive a list of files which is binary garbage (--filelist=FILE)"
|
||||
./datagen -P0 -g1M > tmp_badList
|
||||
$ZSTD -qq -f --file=tmp_badList && die "should have failed : list is binary garbage" # let's avoid printing binary garbage on console
|
||||
$ZSTD -qq -f --filelist=tmp_badList && die "should have failed : list is binary garbage" # let's avoid printing binary garbage on console
|
||||
|
||||
rm -rf tmp*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user