Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Quickits/ZPatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

14 Commits

Repository files navigation

ZPatch

High-performance differential patch library powered by Zstd

License: MIT Release GitHub Actions


Language: English | δΈ­ζ–‡

Overview

ZPatch is a high-performance differential patch library powered by Zstd compression. It uses the old file as a dictionary to compress the new file, achieving significantly higher compression ratios than traditional diff algorithms.

Features

  • πŸš€ High Compression Ratio - Leverages Zstd dictionary compression
  • πŸ“¦ Zero External Dependencies - Pure C++ implementation with bundled Zstd
  • 🌍 Cross-Platform - Supports Android, iOS, Linux, macOS, Windows
  • πŸ“± Android Ready - 16KB page size support for Android 15+
  • πŸ”§ Simple API - Easy to integrate into any project

Downloads

Pre-built binaries are available on the Releases page:

File Platform Architecture
zpatch-darwin-amd64 macOS x86_64
zpatch-darwin-arm64 macOS ARM64 (Apple Silicon)
zpatch-linux-amd64 Linux x86_64
zpatch-android.aar Android AAR Library

Quick Start

CLI Tool

# Show version
./zpatch version
# Create a patch
./zpatch create <old-file> <new-file> <patch-file>
# Apply a patch
./zpatch apply <old-file> <patch-file> <new-file>

Android Integration

Add to your build.gradle.kts:

dependencies {
 implementation("com.github.quickits:zpatch:VERSION")
}

Kotlin API:

import com.quickits.zpatch.ZPatch
// Create patch
val result = ZPatch.createPatch(oldPath, newPath, patchPath)
if (result.isSuccess) {
 println("Patch created: ${result.originalSize} bytes")
}
// Apply patch
val result = ZPatch.applyPatch(oldPath, patchPath, newPath)
if (result.isSuccess) {
 println("File restored: ${result.originalSize} bytes")
}

C++ API

#include "zpatch/core.h"
// Create patch
zpatch::Result result = zpatch::createPatch("old.bin", "new.bin", "patch.zst");
// Apply patch
zpatch::Result result = zpatch::applyPatch("old.bin", "patch.zst", "new.bin");

Building

CLI Tool

cd cli
# Build for current platform
./build-mac-amd64.sh # macOS x86_64
./build-mac-arm64.sh # macOS ARM64
./build-linux-amd64.sh # Linux x86_64
# Build all platforms
./build-all.sh

Android Library

cd android
./gradlew :library:assembleRelease

Core Library

cd core
mkdir build && cd build
cmake ..
make

API Reference

namespace zpatch {
 // Get version information
 const char* getVersion();
 // Create a patch file
 Result createPatch(const char* oldFile, const char* newFile, const char* patchFile);
 // Apply a patch file
 Result applyPatch(const char* oldFile, const char* patchFile, const char* newFile);
}
struct Result {
 int code; // 0 = success, non-zero = failure
 const char* message; // Error message (static string)
 uint64_t originalSize; // Output file size
};

Project Structure

zpatch/
β”œβ”€β”€ core/ # C++ core library
β”œβ”€β”€ cli/ # Command-line tool
β”œβ”€β”€ android/ # Android library + sample app
└── .github/ # GitHub Actions workflows

License

MIT License - see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

Contributors

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /