backup
Advanced tools
Comparing version 1.0.0-3 to 1.0.0-4
18
index.js
@@ -105,3 +105,2 @@ // Copyright Peter Širka, Web Site Design s.r.o. (www.petersirka.sk) | ||
Backup.prototype.backup = function(path, fileName, callback, filter) { | ||
@@ -150,3 +149,3 @@ | ||
if (typeof(fileName) === 'undefined') { | ||
self.complete(); | ||
self.complete(null, self.fileName); | ||
return; | ||
@@ -228,3 +227,4 @@ } | ||
if (!fs.existsSync(fileName)) { | ||
callback(); | ||
if (callback) | ||
callback(new Error('Backup file not found.'), path); | ||
return; | ||
@@ -250,3 +250,9 @@ } | ||
stream.resume(10000); | ||
if (callback) { | ||
stream.on('end', function() { | ||
callback(null, path); | ||
}); | ||
} | ||
stream.resume(); | ||
}; | ||
@@ -343,2 +349,4 @@ | ||
backup.restore(fileName, path, callback, filter); | ||
}; | ||
}; | ||
exports.Backup = Backup; |
{ | ||
"name": "backup", | ||
"version": "1.0.0-3", | ||
"version": "1.0.0-4", | ||
"description": "Web Site backup & restore", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -6,10 +6,21 @@ node.js Backup & Restore | ||
- backup file is text file | ||
- supports backup and restore: files and directories | ||
- simple filtering files and directories | ||
- simple structure | ||
- easy manipulation | ||
- easy use in your project | ||
- executables *backup* and *restore* from terminal | ||
* Backup file is text file | ||
* Supports backup and restore: files and directories | ||
* Simple filtering files and directories | ||
* Simple structure | ||
* Easy manipulation | ||
* Easy use in your project | ||
* Executables *backup* and *restore* from terminal | ||
* __No dependencies__ | ||
## Installation | ||
``` | ||
$ sudo npm install -g backup | ||
// or | ||
$ npm install backup | ||
``` | ||
## node.js | ||
@@ -26,3 +37,3 @@ | ||
@complete {Function} :: optional | ||
@filter {Function} :: optional, param @path {String} return TRUE | FALSE, if FALSE file or directory will skipped | ||
@filter {Function} :: optional, param: @path {String} return TRUE | FALSE, if FALSE file or directory will skipped | ||
*/ | ||
@@ -36,7 +47,6 @@ backup.backup('/path/to/directory/', '/users/petersirka/desktop/website.backup'); | ||
@directory {String} | ||
@complete {Function} :: optional | ||
@filter {Function} :: optional, param @path {String} return TRUE | FALSE, if FALSE file or directory will skipped | ||
@complete {Function} :: optional, param: @err | ||
@filter {Function} :: optional, param: @path {String} return TRUE | FALSE, if FALSE file or directory will skipped | ||
*/ | ||
backup.restore('/users/petersirka/desktop/website.backup', '/path/to/directory/'); | ||
``` | ||
@@ -47,3 +57,2 @@ | ||
``` | ||
// backup current directory | ||
@@ -56,6 +65,4 @@ // $ backup @filename | ||
$ restore /users/petersirka/desktop/website.backup /users/petersirka/desktop/ | ||
``` | ||
## The MIT License | ||
@@ -71,4 +78,8 @@ | ||
## Recommend | ||
[partial.js web application framework](https://github.com/petersirka/partial.js) | ||
## Contact | ||
[www.petersirka.sk](http://www.petersirka.sk) |
11028
259
79