forked from evs-broadcast/node-emberplus
- Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsample.js
More file actions
Latest commit
executable file
·44 lines (41 loc) · 1.24 KB
/
Copy pathsample.js
File metadata and controls
executable file
·44 lines (41 loc) · 1.24 KB
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
41
42
43
44
constDecoder=require('.').Decoder;
constDeviceTree=require(".").DeviceTree;
constfs=require("fs");
constLOCALHOST="0.0.0.0";
constPORT=3336;
fs.readFile("./embrionix.ember",(e,data)=>{
letroot=Decoder(data);
constTreeServer=require("./").TreeServer;
constserver=newTreeServer(LOCALHOST,PORT,root);
server.on("clientError",(e)=>{
console.log(e);
});
server.listen()
.then(()=>{
console.log("listening");
})
.then(()=>{
lettree=newDeviceTree(LOCALHOST,PORT);
returnPromise.resolve()
.then(()=>tree.connect())
.then(()=>{
returntree.getDirectory();
})
.then(()=>tree.disconnect())
.then(()=>tree.connect())
.then(()=>{
returntree.getDirectory();
})
.catch((e)=>{
console.log(e.stack);
})
.then(()=>tree.disconnect())
})
.catch((e)=>{
console.log(e.stack);
})
.then(()=>{
console.log("close");
server.close();
});
});