-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yeyuanfeng
committed
Jul 12, 2017
0 parents
commit 1dc4062
Showing
70 changed files
with
48,276 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Mac | ||
.DS_Store | ||
|
||
# node | ||
*.log | ||
node_modules | ||
|
||
# IDE | ||
.idea | ||
.vscode | ||
|
||
# project | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Mac | ||
.DS_Store | ||
|
||
# node | ||
*.log | ||
node_modules | ||
|
||
# IDE | ||
.idea | ||
.vscode | ||
|
||
# project | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env node | ||
|
||
const program = require('commander'); | ||
const bsdp = require('../index'); | ||
|
||
program | ||
.version(require('../package').version, '-v, --version') | ||
.usage('<command> [old] [new] [patch]'); | ||
|
||
program | ||
.command('diff [old] [new] [patch]') | ||
.description('make a diff between an old file and a new file, and generate a patch') | ||
|
||
program | ||
.command('patch [old] [new] [patch]') | ||
.description('apply a patch to an old file and generate a new file'); | ||
|
||
program | ||
.arguments('<cmd> [old] [new] [patch]') | ||
.action((cmd, oldFile, newFile, patchFile) => { | ||
if(cmd !== 'diff' && cmd !== 'patch') { | ||
console.log('invalid command'); | ||
return; | ||
} | ||
|
||
if(!oldFile) { | ||
console.log('old file is not specified'); | ||
return; | ||
} | ||
|
||
if(!newFile) { | ||
console.log('new file is not specified'); | ||
return; | ||
} | ||
|
||
if(!patchFile) { | ||
console.log('patch file is not specified'); | ||
return; | ||
} | ||
|
||
bsdp[cmd](oldFile, newFile, patchFile); | ||
}); | ||
|
||
program.parse(process.argv); | ||
|
||
const args = program.args; | ||
|
||
if(args.length <= 0) { | ||
program.help(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "bsdiff", | ||
"sources": [ | ||
"src/main.cc", | ||
"src/bsdiff/bsdiff.c", | ||
"src/bspatch/bspatch.c", | ||
"src/bzip2/bzlib.c", | ||
"src/bzip2/compress.c", | ||
"src/bzip2/crctable.c", | ||
"src/bzip2/randtable.c", | ||
"src/bzip2/blocksort.c", | ||
"src/bzip2/huffman.c", | ||
"src/bzip2/decompress.c" | ||
], | ||
"include_dirs": [ | ||
"include", "./src/bzip2" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const bsdiff = require('./build/Release/bsdiff.node'); | ||
|
||
module.exports = bsdiff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "bsdp", | ||
"version": "1.0.0", | ||
"description": "An binary diff&patch library based on bsdiff algorithm(v4.3)", | ||
"bin": { | ||
"bsdp": "./bin/bsdp" | ||
}, | ||
"main": "index.js", | ||
"dependencies": { | ||
"commander": "^2.11.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^3.4.2" | ||
}, | ||
"scripts": { | ||
"test": "mocha", | ||
"install": "node-gyp rebuild" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/tsyeyuanfeng/bsdp.git" | ||
}, | ||
"keywords": [ | ||
"bsdiff", | ||
"bspatch", | ||
"binary", | ||
"diff", | ||
"binary", | ||
"patch" | ||
], | ||
"author": "Yaphet Ye <tsyeyuanfeng@126.com>", | ||
"license": "MIT", | ||
"gypfile": true, | ||
"bugs": { | ||
"url": "https://github.com/tsyeyuanfeng/bsdp/issues" | ||
}, | ||
"homepage": "https://github.com/tsyeyuanfeng/bsdp#readme" | ||
} |
Oops, something went wrong.