-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfs.js
43 lines (38 loc) · 943 Bytes
/
fs.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
const fs = require("fs");
const path = require("path");
// fs.writeFile("example.txt", "this is an example", err => {
// if (err) {
// console.log(err);
// } else {
// console.log("file created");
// fs.readFile("example.txt", "utf8", (err, file) => {
// if (err) console.log(err);
// else console.log(file);
// });
// }
// });
// fs.rename("example.txt", "example2.txt", err => {
// if (err) {
// console.log(err);
// } else {
// console.log("file renamed");
// }
// });
// fs.appendFile("example2.txt", "\ndata appended", err => {
// if (err) {
// console.log(err);
// } else {
// console.log("data appended");
// }
// });
// fs.unlink("example2.txt", err => {
// if (err) {
// console.log(err);
// } else {
// console.log("file deleted");
// }
// });
fs.mkdir(path.join(__dirname, "/test"), {}, err => {
if (err) throw err;
console.log("created...");
});