ivan-data 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chatgptwork.js +67 -0
- package/nodejs/write.js +1 -0
- package/notes/notes.txt +1 -0
- package/package.json +13 -0
package/chatgptwork.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
/*const fs=require('fs')
|
|
3
|
+
const path=require('path')
|
|
4
|
+
|
|
5
|
+
const dirPath=path.join(__dirname,'notes')
|
|
6
|
+
if(!fs.existsSync(dirPath)){
|
|
7
|
+
fs.mkdirSync(dirPath)
|
|
8
|
+
}else{
|
|
9
|
+
console.log('Folder already exist')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const filePath=path.join(__dirname,'notes' , 'notes.txt');
|
|
13
|
+
fs.writeFile(filePath,'I have done the task',(error)=>{
|
|
14
|
+
if(error){
|
|
15
|
+
console.log(error)
|
|
16
|
+
return;
|
|
17
|
+
}else{
|
|
18
|
+
console.log('File written successfully')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
fs.readFile(filePath ,'utf-8', (error,data) =>{
|
|
23
|
+
if(error){
|
|
24
|
+
console.log(error)
|
|
25
|
+
}else{
|
|
26
|
+
console.log('File read successfully')
|
|
27
|
+
console.log(data)
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const name ="IVAN"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const { error } = require('console')
|
|
41
|
+
const fs=require('fs')
|
|
42
|
+
const path=require('path')
|
|
43
|
+
|
|
44
|
+
const dirPath=path.join(__dirname,'nodejs')
|
|
45
|
+
if(!fs.existsSync(dirPath)){
|
|
46
|
+
fs.mkdirSync(dirPath)
|
|
47
|
+
}else{
|
|
48
|
+
console.log('Folder already exists')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const filePath=path.join(__dirname,'nodejs','write.js');
|
|
53
|
+
fs.appendFile(filePath ,'Hey there',(error) =>{
|
|
54
|
+
if(error){
|
|
55
|
+
console.error
|
|
56
|
+
}else{
|
|
57
|
+
console.log('File writing successfully')
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
fs.readFile(filePath,'utf-8' , (error,data) =>{
|
|
62
|
+
if(error){
|
|
63
|
+
console.log(error)
|
|
64
|
+
}else{
|
|
65
|
+
console.log(data)
|
|
66
|
+
}
|
|
67
|
+
})
|
package/nodejs/write.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
HiHiIVAN
|
package/notes/notes.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I have done the task
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ivan-data",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A js package that creates folder if not existing creates file writes in the file and then reads the contents of the file ",
|
|
5
|
+
"main": "chatgptwork.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": ["directory", "create-file" , "create-folder" , "read-file" , "nodejs","filesystem"],
|
|
10
|
+
"author": "Hirwa Yvan",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"type": "commonjs"
|
|
13
|
+
}
|