-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.js
38 lines (34 loc) · 996 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const http = require("http");
http.createServer(function (req, res) {
}).listen(3000, "127.0.0.1");
const {Rem2LocSync, Loc2RemSync} = require("./src/index");
let config = {
"host": "example.com",
"user": "anonymous",
"pass": "guest",
"port": 21,
"local": "D:\\ftp-sync-testing",
"remote": "/files",
"ignore": [
"/folder",
"*.mp3",
"/backgrounds"
],
"connections": 1,
//retry times on ETIMEDOUT error
"retryLimit": 3,
"verbose": true
};
/**
* console as a logger or any other logger that supports `info`, `debug`, `error` methods
* @type {BaseSync}
*/
//const synchronizer = new Rem2LocSync(config, console);
const synchronizer = new Loc2RemSync(config, console);
const interval = setInterval(() => {
console.log("synchronizer status", synchronizer.getUpdateStatus());
}, 5000);
synchronizer.run((err, results) => {
clearInterval(interval);
console.log("run response", synchronizer.getUpdateStatus());
})