Skip to content

Commit 4e881c9

Browse files
Add files via upload
1 parent 7978870 commit 4e881c9

File tree

2 files changed

+12
-43
lines changed

2 files changed

+12
-43
lines changed

index.js

+5-43
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,7 @@
1-
// creatinf a txt file using fs module
1+
const os = require("os");
2+
let versionos = os.release();
3+
console.log("OS RELEASE:",versionos);
4+
let osname = os.type();
5+
console.log("operating system name :",osname);
26

3-
const { log } = require("console");
4-
const fs = require("fs");
5-
let info = "NodeJS is built on an event-driven architecture, which is fundamental to its asynchronous and non-blocking I/O model. This architecture revolves around the concept of events, event emitters, and event listeners, enabling efficient handling of asynchronous operations and concurrent requests."
6-
fs.appendFile('node_architecture.txt',info,(err) => {
7-
if (err) throw err;
8-
console.log('The "data to append" was appended to file!')}
9-
);
107

11-
// reading and consoling data from a file on terminal
12-
13-
let pathname = "./node_architecture.txt";
14-
fs.readFile(pathname,'utf-8',(err,data)=>{
15-
if(err){
16-
console.log('error reading the file',err);
17-
return;
18-
19-
}
20-
console.log('file content',data);
21-
22-
23-
})
24-
25-
// appending data to the file
26-
27-
28-
const appendData = 'Node.js allows programmers to develop server-side JavaScript and frontend JavaScript codes with simplicity. One of the major Node.js advantages is that it eliminates the need for two resource teams, saving time, money, and energy for overall project development.';
29-
30-
fs.appendFile('node_architecture.txt', appendData, (err) => {
31-
if (err) {
32-
console.log("Couldn't append data:", err);
33-
} else {
34-
console.log("Content appended successfully to the file");
35-
}
36-
});
37-
38-
// deleting created file
39-
fs.unlink('node_architecture.txt', (err) => {
40-
if (err) {
41-
console.error("Error deleting the file:", err);
42-
} else {
43-
console.log("File deleted successfully!");
44-
}
45-
});

indexserver.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const http =require("http");
2+
const server =http.createServer((req,res)=>{
3+
res.write('i am happy to learn full stack web development from pw skills');
4+
res.end();
5+
6+
7+
}).listen(8000);

0 commit comments

Comments
 (0)