Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

google/xdelta3-decoder-js

This code is in a very rough state.

This is a Javascript port of XDelta3 C++ decoder. See the XDelta3 website for infomation on XDelta3: http://xdelta.org/

XDelta3 is written in C and can compress, make diffs, and decode (re-expand) binary as well as text files. As a file compressor XDelta3 deltas are slightly larger than the same file compressed with gzip. However, depending on the data, XDelta3 diffs can be dramatically smaller than the compressed files.

This port to Javascript only implements the decoder. To use this Javacript code use the XDelta3 C code to diff or compress files and use this Javascript code to decode the files in the browser.

This port was done by adding print statements to the C code and then making the Javascript mirror the C code. When decoding files the outputs of the C and Javascript code should be identical. Meld is a useful tool for comparing the 2 print outputs. The debug_save() routine can be used to save the Javascript print outputs without the console line numbers.

To make changes to this code:

  1. compile the XDelta C code using the C files with the print statements
  2. decode a test file using the C code and save the print statements in a file
  3. modify the xdelta3_decoder_with_debug.js
  4. decode the same test file in the browser
  5. copy the dev console log to a file
  6. verify that the C and Javascript print statements are identical

This Javascript has be tested on smaller (300KB) files.