-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileStorageServer.js
More file actions
40 lines (32 loc) · 971 Bytes
/
fileStorageServer.js
File metadata and controls
40 lines (32 loc) · 971 Bytes
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
39
40
/**
* Created by korolev on 24.10.16.
*/
'use strict';
var fs = require('fs'),
path = require('path'),
eventHandler = require(__base + 'server-architecture/eventHandler');
class fileStorageServer extends eventHandler{
constructor(options) {
super();
console.log("my construct hit")
}
init() {
this.trigger('init-complete', this);
}
registerNewClient(socket) {
console.log('socket maintaince');
socket.on("foo", function (data) {
console.log("azzzzzzzz = " + data)
});
var path = "/Users/korolev/tmp/tstfile.txt";
var data = "Hello from the Node writeFile method!";
fs.writeFile(path, data, function(error) {
if (error) {
console.error("write error: " + error.message);
} else {
console.log("Successful Write to " + path);
}
});
}
}
module.exports = fileStorageServer;