实现rsync二进制diff算法的python 3模块。

pyrsync2的Python项目详细描述


这是pyrsync包的一个分支,其中包含一些更改,如:

  • The functions blockchecksums and rsyncdelta are now generators which make it easier to send through the network
  • Some unittests are added
  • Implementation changes (uses bytearray instead of a deque, faster hash lookup etc.)
  • The block size is no longer in the delta itself, it needs to be passed to the patchstream function
  • Does not use try/except for programming logic

这是一个python 3专用包!

pyrsync2是一个python模块,它实现了[rsync算法][1], 用纯python编写。它不是rsync的包装器,而是一组 通过python应用完整rsync功能的函数。

这个模块的大部分代码来自 在activestate[2]发布。它最初是根据[麻省理工学院许可证]授权的 [3],本许可证未作任何修改。

##安装

你需要有pip:

$ sudo pip install pyrsync2

##使用

此模块的示例用例:

# On the system containing the file that needs to be patched >>> import pyrsync2 >>> unpatched = open(“unpatched.file”, “rb”) >>> hashes = pyrsync2.blockchecksums(unpatched)

# On the remote system after having received hashes >>> import pyrsync2 >>> patchedfile = open(“patched.file”, “rb”) >>> delta = pyrsync2.rsyncdelta(patchedfile, hashes)

# System with the unpatched file after receiving delta >>> unpatched.seek(0) >>> save_to = open(“locally-patched.file”, “wb”) >>> pyrsync2.patchstream(unpatched, save_to, delta)

[1]:http://samba.anu.edu.au/rsync/“安德鲁·特里吉尔和保罗·麦凯拉斯。rsync算法。技术报告TR-CS-96-05,堪培拉0200法案,澳大利亚,1996年。” [2]:https://code.activestate.com/recipes/577518-rsync-algorithm/“rsync算法(python配方)” [3]:http://www.opensource.org/licenses/mit-license.php“OSI MIT许可证”

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
使用java的html并排表   如何修复Java(安卓)中的“找不到自由端口”错误   java为什么在以下代码中实现接口“onmapreadycallback”时出错?   java在Spring批处理中重置InMemory数据库   java非阻塞网络编程超时问题   安卓 Java:从UTF8字符串创建可绘制   java显示文本文件中包含的路径中的图像   gzipinputstream Java。伊奥。IOException:不是GZIP格式   java线程调度程序如何执行此代码?   java通过setFragmentResult将信息发送到另一个片段   java从任何地方进入活动   java如何使用SNMP4j开发用于搜索OID值的类   Java中的递归字符串索引超出范围错误(字符串索引超出范围异常)   缓存如何清除Java缓存中的特定文件?   java将构建任务添加到maven pom项目   java FileOutputStream非常慢   如果定义了父pom,则不会发生存储库url的java Maven属性替换