Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/llafuente/dmirror
A real-time folder synchronization on Windows/Linux/Mac (any platform that NodeJS support) support multiple target protocols: FileSystem and FTP
https://github.com/llafuente/dmirror
Last synced: 1 day ago
JSON representation
A real-time folder synchronization on Windows/Linux/Mac (any platform that NodeJS support) support multiple target protocols: FileSystem and FTP
- Host: GitHub
- URL: https://github.com/llafuente/dmirror
- Owner: llafuente
- Created: 2012-10-05T14:30:52.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-05-17T12:57:47.000Z (over 11 years ago)
- Last Synced: 2024-11-07T06:43:11.122Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 215 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dmirror [![Build Status](https://secure.travis-ci.org/llafuente/dmirror.png?branch=master)](http://travis-ci.org/llafuente/dmirror)
=======A real-time folder synchronization on Windows/Linux/Mac (any platform that NodeJS support) support multiple target protocols: FileSystem and FTP.
The real-time synchronization (Raid class) mirror all changes in the other side but do not synchronize both at first to make sure the are both the same. For this first synchronization use: Sync class.Status: No error found, so stable :)
Common for the following examples.
If you want to know more... take a look to the test I try to cover 100% the code.```js
var Raid = require("./index.js").Raid,
Sync = require("./index.js").Sync,
winston = require("winston");winston.add(winston.transports.File, { filename: "log" });
winston.remove(winston.transports.Console);```
Real-time folder synchronization
=======FTP
```js
var r = new Raid({
source: "",
protocol: "ftp", // or fs
target: {
host: "",
user: "",
pass: "",
dir: "",
},
exclude: [new RegExp("/^\./")],
loggin: winston,
//optional
recursive: true, // true by default
});```
Filesystem
```js
var r = new Raid({
source: "",
protocol: "fs",
target: {
dir: ""
},
exclude: [new RegExp("\.svn")],
polling: 1000, // 500 by default
loggin: winston,
//optional
recursive: true, // true by default
});```
Folder synchronization
=======FTP is not supported atm.
Filesystem
```js
var sync = new Sync({
source: "",
loggin: winston,
protocol: "fs",
target: {
dir: "",
}
});```
FAQ
=======* Can I mirror a samba directory?
Yes, you need to "Connect to a network drive" and the protocol is filesystem :)
There are some problems involved that you may encounter if you run sync/raid against samba using the "windows task scheduler".
You may see that you don't have access to the share resource (wtf!). So you need to create that resource each time (workaround!)Solve it with this code, fill the "".
```js
var spawn = require('child_process').spawn,
//delete current connection to the resource
connect_delete = spawn('net', ['use', '\\\\\\', '/DELETE']);connect_delete.on('close', function (code) {
winston.log("error", 'net use delete exit with: ' + code);
//when fisnish, reconnect the resource, you may need user/pwd
connect = spawn('net', ['use', 'x:','\\\\\\', '/USER:\\', ''])
connect.stderr.setEncoding('utf8');
connect.stdout.setEncoding('utf8');connect.stdout.on('data', function (data) {
winston.log("info", data);
});connect.stderr.on('data', function (data) {
winston.log("error", data);
});connect.on('close', function (code) {
winston.log("error", 'net use exit with: ' + code);
setTimeout(function() {
sync.sync(); // access the resource!
}, 10000); // give a few seconds to windows...
});
});
```TODO LIST
=======* Windows taskbar support, I will develop the module if I have time... sometime...
* fill an issue if you need anything more, for me is what i was looking for a replacement/alternative to mirrorfolder.