Skip to content

Commit

Permalink
Add package metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed Feb 11, 2023
1 parent 1b799bc commit ac54440
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Release Notes

## 1.0.0

* Initial release.
* Port of bsdiff 4.3 to managed code.
8 changes: 8 additions & 0 deletions src/BsDiff/BsDiff.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>true</IsPackable>
<Description>.NET port of bsdiff, Colin Pervical's binary diff/patch utility, in 100% managed code.</Description>
<PackageId>BsDiff</PackageId>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>bsdiff;bspatch;binary;patch</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SharpZipLib" Version="1.4.2" />
</ItemGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions src/BsDiff/README.md
Original file line number Diff line number Diff line change
@@ -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);
```

0 comments on commit ac54440

Please sign in to comment.