Difflytic creates and applies binary diffs, supporting multiple files and streaming diff access. This is ideal for scenarios where large files are split into smaller components, like audio, video and subtitle files extracted from a MKV container. Difflytic's diff format also enables software to stream files directly from the diff file without needing to extract the entire file first, thus ensuring efficient random access.
You can download pre-built binary releases from the Releases page:
difflytic-linux
: Linux (Any CPU) build. Requires.NET 8
.difflytic-linux-x64
: Linux (x64) native build. No dependencies.difflytic-macos
: MacOS (Any CPU) build. Requires.NET 8
.difflytic-macos-arm64
: MacOS (ARM64) native build. No dependencies.difflytic-win
: Windows (Any CPU) build. Requires.NET 8
.difflytic-win-x64
: Windows (x64) native build. No dependencies.
Alternatively, you can build from source. You'll need the .NET SDK installed.
Depending on the operating system and architecture, the binary may be named differently.
To create a diff file from an old file and one or more new files:
difflytic-linux <oldPath> <newPaths...> <diffPath>
oldPath
: Path to the old file.newPaths
: Path(s) to one or more new files.diffPath
: Path where the diff file will be saved.
To extract the new files from a diff file:
difflytic-linux <oldPath> <diffPath>
oldPath
: Path to the old file.diffPath
: Path to the diff file.
The new files will be saved next to the diff file.
dotnet add Difflytic
A block size is required to divide the old file into blocks. If you are unsure about the size, derive one:
var blockSize = BlockSize.GetSize(oldPath);
Now create a Differ
using the default MLCG
block hash:
var differ = new Differ(blockSize);
Then you can create the diff file:
differ.Diff(diffPath, newPaths, oldPath);
Extracting a diff will use the block size and block hash used to create the diff:
Patcher.Patch(diffPath, oldPath, outputPath)
Open a diff file for reading:
var reader = Reader.Create(diffPath, oldPath);
Now you can iterate over the new files in the diff file:
foreach (var file in reader) {}
Then you can open a new file as a stream:
using var stream = reader.Open(file);
We welcome contributions from the community! If you have suggestions for improvements, bug fixes, or new features, please feel free to submit a pull request or open an issue on our GitHub page. Your feedback and contributions make Difflytic better for everyone.