Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yeyuanfeng committed Jul 12, 2017
0 parents commit 1dc4062
Show file tree
Hide file tree
Showing 70 changed files with 48,276 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
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
13 changes: 13 additions & 0 deletions .npmignore
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
50 changes: 50 additions & 0 deletions bin/bsdp
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();
}
22 changes: 22 additions & 0 deletions binding.gyp
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"
]
}
]
}
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const bsdiff = require('./build/Release/bsdiff.node');

module.exports = bsdiff;
38 changes: 38 additions & 0 deletions package.json
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"
}
Loading

0 comments on commit 1dc4062

Please sign in to comment.