Skip to main content

Python ctypes wrapper for librsync.

Project description

Travis CI Status

A SmartFile Open Source project. Read more about how SmartFile uses and contributes to Open Source software.

SmartFile

Introduction

A ctypes wrapper for librsync. Provides signature(), delta(), and patch() functions.

There are three steps necessary to synchronize a file. Two steps are performed on the source file and one on the destination.

  1. Generate a signature for the destination file.

  2. Generate a delta for the source file (using the signature).

  3. Patch the destination file using the generated delta.

Usually, these steps involve remote systems. Here is an example of synchronizing two local files.

import librsync

# The destination file.
dst = file('Resume-v1.0.pdf', 'rb')
# The source file.
src = file('Resume-v1.2.pdf', 'rb')
# Where we will write the synchronized copy.
synced = file('Resume-latest.pdf', 'wb')

# Step 1: prepare signature of the destination file
signature = librsync.signature(dst)

# Step 2: prepare a delta of the source file
delta = librsync.delta(src, signature)

# Step 3: synchronize the files.
# In many cases, you would overwrite the destination with the result of
# synchronization. However, by default a new file is created.
librsync.patch(dst, delta, synced)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-librsync-0.1-1.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file python-librsync-0.1-1.tar.gz.

File metadata

File hashes

Hashes for python-librsync-0.1-1.tar.gz
Algorithm Hash digest
SHA256 22157750999778b6d26848b2b38311e3abac3c3b5e9adda4dba6db17f621e51a
MD5 ee86e25d0b6b323224793b0c9a0daad0
BLAKE2b-256 06a8338c71cd584d3a75ac5f75ab7a485a65127b4e8d95c2829522f8102c2c1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page