-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.js
109 lines (80 loc) · 2.27 KB
/
index2.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var things = require('./things');
var events = require('events');
var fs = require('fs');
/////////////////////////////////FILE///////////////////////////
// var file_readed = fs.readFileSync('text.txt', 'utf8'); //SYNC
// var message = "Hi world \n" + file_readed;
// fs.writeFileSync('someText.txt', message);
fs.readFile('someText.txt', 'utf8', function (err, data) { //ASYNC
console.log(data);
});
fs.writeFile('someText2.txt', 'HI TEXT 2', function (err, data) {});
console.log("test");
// fs.unlink('file.txt', function () {}); //DELETE FILE
// fs.mkdirSync('new-one');
// fs.rmdirSync('new-one');
fs.unlink('./New/file1.txt', function () {}); //DELETE FILE
fs.rmdir('New', function () {});
// fs.mkdir('New2',function () {
// fs.writeFile('./New/file1.txt', 'HELLO FILE2' , function () {
// console.log("ALL OK");
// })
// });
// console.log(file_readed);
/////////////////////////////////util////////////////////////////
// var util = require('util');
//
// var Cars = function (model) {
// this.model = model;
// };
//
// util.inherits(Cars, events.EventEmitter);
//
// var bmv = new Cars('BMW');
// var audi = new Cars('AUDI');
// var mers = new Cars('MERS');
//
//
// var cars = [bmv,audi,mers];
//
// cars.forEach(function (car) {
// car.on('speed', function (text) {
// console.log(car.model + " speed is - " + text);
// });
// });
//
// bmv.emit("speed", '256 km');
// audi.emit("speed", '380 km');
///////////////////////////////////////////////////////////////////////
// console.log(things.array_counter([4,456.48,7,9]));
// console.log(things.val);
// console.log(things.multyply(89,7));
// var myEmit = new events.EventEmitter();
//
//
// myEmit.on('some_event', function (text) {
// console.log(text);
// });
//
// myEmit.emit("some_event", 'RUN...');
// console.log(__filename);
// console.log(__dirname);
// function test() {
// console.log("TESTT");
// }
//
// test();
//
//
// function call(func) {
// func();
// }
//
// var printSom = function () {
// console.log("TESTT2");
// };
//
// printSom();
//
// call(printSom);
//https://www.digitalocean.com/community/tutorials/node-js-ubuntu-16-04-ru