diff --git a/ReleaseNotes.md b/ReleaseNotes.md new file mode 100644 index 0000000..4fbf2e8 --- /dev/null +++ b/ReleaseNotes.md @@ -0,0 +1,6 @@ +# Release Notes + +## 1.0.0 + +* Initial release. +* Port of bsdiff 4.3 to managed code. diff --git a/src/BsDiff/BsDiff.csproj b/src/BsDiff/BsDiff.csproj index a3c0ba1..810e1e5 100644 --- a/src/BsDiff/BsDiff.csproj +++ b/src/BsDiff/BsDiff.csproj @@ -3,10 +3,18 @@ netstandard2.0 true + .NET port of bsdiff, Colin Pervical's binary diff/patch utility, in 100% managed code. + BsDiff + README.md + bsdiff;bspatch;binary;patch + + + + diff --git a/src/BsDiff/README.md b/src/BsDiff/README.md new file mode 100644 index 0000000..6e121c3 --- /dev/null +++ b/src/BsDiff/README.md @@ -0,0 +1,24 @@ +## About + +BsDiff is a 100% managed implementation of Colin Percival's [bsdiff algorithm](https://www.daemonology.net/bsdiff/). +It provides functions to create a patch between two binary files and to apply that patch (to the first file, producing the second file). +The patch is usually much smaller than the size of the second file, so this can be used to optimize download size. + +## Usage + +Given two existing files, you can create a patch as follows: + +```csharp +var oldFileBytes = File.ReadAllBytes("oldFile"); +var newFileBytes = File.ReadAllBytes("newFile"); +using var outputStream = File.Create("patchFile"); +BinaryPatch.Create(oldFileBytes, newFileBytes, outputStream); +``` + +You can then apply the patch to the old file to produce the new file: + +```csharp +using var oldFile = File.OpenRead("oldFile"); +using var newFile = File.Create("newFile"); +BinaryPatch.Apply(oldFile, () => File.OpenRead("patchFile"), newFile); +```