Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sewer56/sewer56.deltapatchgenerator
Library to generate basic delta patches which transform a folder from one state to another.
https://github.com/sewer56/sewer56.deltapatchgenerator
Last synced: 19 days ago
JSON representation
Library to generate basic delta patches which transform a folder from one state to another.
- Host: GitHub
- URL: https://github.com/sewer56/sewer56.deltapatchgenerator
- Owner: Sewer56
- License: apache-2.0
- Created: 2021-09-30T18:11:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-24T22:54:41.000Z (over 2 years ago)
- Last Synced: 2024-10-06T10:39:20.809Z (about 1 month ago)
- Language: C#
- Homepage:
- Size: 96.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Delta Patch Generator Lib by Sewer56
This is an easy to comsume, fast library for generating Delta Patches.
Note: API is folder based. All operations act on folders and effect all files inside.
## Basic Usage: Verify FilesGenerate Hash Set:
```csharp
// Generate a set of hashes for a directory.
var hashes = HashSet.Generate(Assets.MismatchFolderOriginal);
```Verify:
```csharp
// missingFiles: Files missing from target folder.
// hashMismatches: Files with a non-matching hash.
bool matches = HashSet.Verify(hashes, targetFolder, out var missingFiles, out var hashMismatches)
```## Basic Usage: Generate Patch
Generate:
```csharp
// Create a patch that transforms one folder into another.
// Save it into `patchFolder`
var patch = Patch.Generate(originalFolder, targetFolder, patchFolder);
```Apply:
```csharp
// Patches all files in folderToPatch. Patched files are moved to patchedFilesOutput.
Patch.Apply(patch, folderToPatch, patchedFilesOutput);
```- Patches use VCDiff based Delta Compression using an optimized port of Google `open-vcdiff`.
## Basic Usage: Cleanup
Delta generator can also be used to remove any files outside of a provided list of files.
```csharp
// Make Hashes
var hashes = HashSet.Generate(Assets.AddMissingFileFolderOriginal);// Remove extra files.
HashSet.Cleanup(hashes, folder);
```You can supply an event/function that can be used to confirm whether a file can be deleted.
## Basic Usage: General
Results of most operations (e.g. `Patch.Generate()`, `HashSet.Generate()`) and be saved and loaded from disk.
## Limitations
- RAM: Memory usage explodes relative to file size. When creating a patch for a 1.5GB file, expect 6GB+ RAM usage. Applying patches is pretty much free though.- File Size: Max file size for individual file is 2GB.
## Additional Credits
### VCDiff Implementation
- Folks at Google for creating open-vcdiff.
- Metric for porting open-vcdiff to .NET.
- SnowflakePowered (Ronny Chan) for optimizing the .NET port of open-vcdiff.Additional optimisations by myself :)
### Hashing Implementation
- Yann Collet for creating the `xxHash` hashing algorithm.
- Melnik Alexander for high performance port of `xxHash`.### Doki Doki Literature Club
- A Product of Team Salvato.