command-line guide

xdelta3 can be run with syntax familiar but not similar to gzip; it requires you to specify the output file in most cases, rather than applying any default filename extensions. These are cases that resemble gzip:

xdelta3 -c file_to_compress > delta_file
xdelta3 -dc delta_file > file_uncompressed

The -c option says to write to the standard output. The -d option says to decode. The default action is to encode (also specified by -e). xdelta3 also supports long command names, these two commands are equivalent to the ones abvove:

xdelta3 encode file_to_compress > delta_file
xdelta3 decode delta_file > file_uncompressed

xdelta3 has the notion of a default filename for decoding. If you specified a file name during the encode step, it is used as the default for decoding. The -s option specifies a source file for delta-compression.

xdelta3 -s source_file target_file delta_file
xdelta3 -d delta_file

The second line above fills in "source_file" and "target_file" as the input and output filenames. Without the -f option, xdelta3 will not overwrite an existing file. When there are no default filenames (e.g., in decode), standard input and standard output are used. In the example below, the default source filename is applied in decoding.

cat target_file | xdelta3 -s source_file > delta_file
xdelta3 -d < delta_file > target_file.1

xdelta3 recognizes externally compressed inputs, so the following command produces the expected results:

xdelta3 -s beta2.tar.gz beta3.tar.gz beta3.tar.gz.xd
xdelta3 -ds beta2.tar.gz beta3.tar.gz.xd beta3.tar.gz.1

You can avoid the intermediate file and use xdelta3 together with a tar-pipeline.

tar -cf - beta3 | xdelta3 -s beta2.tar > beta3.tar.xd
xdelta3 -d beta3.tar.xd | tar -xf -

xdelta can print various information about a compressed file with the "printhdr" command. The "printhdrs" command prints information about each window of the encoding. The "printdelta" command prints the actual encoding for each window, in human-readable format.

# xdelta3 printdelta delta_file
VCDIFF version:               0
VCDIFF header size:           5
VCDIFF header indicator:      none
VCDIFF secondary compressor:  none
VCDIFF window number:         0
VCDIFF window indicator:      VCD_SOURCE VCD_ADLER32 
VCDIFF adler32 checksum:      48BFADB6
VCDIFF copy window length:    2813
VCDIFF copy window offset:    0
VCDIFF delta encoding length: 93
VCDIFF target window length:  2903
VCDIFF data section length:   72
VCDIFF inst section length:   8
VCDIFF addr section length:   3
  Offset Code Type1 Size1 @Addr1 + Type2 Size2 @Addr2
  000000 019  CPY_0 1535 @0     
  001535 001  ADD     72        
  001607 019  CPY_0 1296 @1517  

xdelta3 -h

usage: xdelta3 [command/options] [input [output]]
special command names:
    config      prints xdelta3 configuration
    decode      decompress the input
    encode      compress the input
    test        run the builtin tests
special commands for VCDIFF inputs:
    printdelta  print information about the entire delta
    printhdr    print information about the first window
    printhdrs   print information about all windows
standard options:
   -0 .. -9     compression level
   -c           use stdout
   -d           decompress
   -e           compress
   -f           force overwrite
   -h           show help
   -q           be quiet
   -v           be verbose (max 2)
   -V           show version
memory options:
   -B blksize   source file block size
   -M memsize   memory budget for hash tables
   -W winsize   input window buffer size
compression options:
   -s source    source file to copy from (if any)
   -S [djw|fgk] enable/disable secondary compression
   -N           disable small string-matching compression
   -D           disable external decompression (encode/decode)
   -R           disable external recompression (decode)