Skip to content

lalawue/lua-bsdiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modified from https://github.com/mendsley/bsdiff.git

About

memory bsdiff / bspatch lib for Lua, no compress, you can compress it by another library.

Usage

local bsdiff = require("bsdiff")

local old_content = [[..anything..]]
local new_content = [[..anything...]]

-- generate patch
local patch, emsg = bsdiff.diff(old_content, new_content)
if emsg then
    print("diff error: ", emsg)
    os.exit(0)
end
print("patch length: ", patch:len())

-- generate another new_content
local out_content, emsg = bsdiff.patch(old_content, patch)
if emsg then
    print("patch error: ", emsg)
    os.exit(0)
end

print("content equal: ", new_content == out_content)