Commit ecfc52f7 authored by Giacomo Lavermicocca's avatar Giacomo Lavermicocca

client handle start writing file code

parent e1b30446
var client = require('scp2'); var Client = require('node-rest-client').Client;
var client = new Client();
var obj;
function clientGet()
{
// direct way
client.get("http://10.8.0.1:3000/getFiles", function (data, response) {
// parsed response body as js object
// raw response
data = data.toString('utf8');
obj = JSON.parse(data);
console.log(obj.list);
obj.list.forEach(function (item) {
console.log(item.name);
});
});
function startHere() {
console.log("Sono passato di qua...");
client.scp('/root/.config/transmission-daemon/torrents/', 'root:viabadia1982!@10.8.0.10:8022:/mnt1/stuff/Downloads/torrentWatch/', function(err) {console.log(err);})
} }
startHere(); clientGet();
setInterval(startHere, 60000);
\ No newline at end of file setInterval(clientGet, 60000);
\ No newline at end of file
...@@ -314,6 +314,24 @@ ...@@ -314,6 +314,24 @@
"unpipe": "1.0.0" "unpipe": "1.0.0"
} }
}, },
"follow-redirects": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.2.6.tgz",
"integrity": "sha512-FrMqZ/FONtHnbqO651UPpfRUVukIEwJhXMfdr/JWAmrDbeYBu773b1J6gdWDyRIj4hvvzQEHoEOTrdR8o6KLYA==",
"requires": {
"debug": "3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"forever-agent": { "forever-agent": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
...@@ -550,6 +568,31 @@ ...@@ -550,6 +568,31 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
}, },
"node-rest-client": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/node-rest-client/-/node-rest-client-3.1.0.tgz",
"integrity": "sha1-4L623aeyDMC2enhHzxLF/EGcN8M=",
"requires": {
"debug": "2.2.0",
"follow-redirects": "1.2.6",
"xml2js": "0.4.19"
},
"dependencies": {
"debug": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"requires": {
"ms": "0.7.1"
}
},
"ms": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg="
}
}
},
"oauth-sign": { "oauth-sign": {
"version": "0.8.2", "version": "0.8.2",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
...@@ -671,6 +714,11 @@ ...@@ -671,6 +714,11 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
}, },
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"scp2": { "scp2": {
"version": "0.5.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/scp2/-/scp2-0.5.0.tgz", "resolved": "https://registry.npmjs.org/scp2/-/scp2-0.5.0.tgz",
...@@ -845,6 +893,20 @@ ...@@ -845,6 +893,20 @@
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": "1.2.4",
"xmlbuilder": "9.0.4"
}
},
"xmlbuilder": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.4.tgz",
"integrity": "sha1-UZy0ymhtAFqEINNJbz8MruzKWA8="
} }
} }
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"dependencies": { "dependencies": {
"directory-tree": "2.0.0", "directory-tree": "2.0.0",
"express": "^4.16.2", "express": "^4.16.2",
"node-rest-client": "^3.1.0",
"request": "2.83.0", "request": "2.83.0",
"scp2": "^0.5.0" "scp2": "^0.5.0"
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment