-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
ziliao/ | ||
code/0201/node_modules | ||
code/0301/node_modules | ||
code/0301/node_modules | ||
code/0501/electron-quick-start/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
worldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const fs=require("fs"); | ||
|
||
|
||
var content=fs.readFileSync("./1.txt"); | ||
console.log(content.toString()); | ||
|
||
|
||
fs.writeFile("./2.txt","hello",{flag:"a"},(err)=>{ | ||
console.log("写入成功"); | ||
}); | ||
|
||
fs.writeFile("./2.txt","world",{flag:"a"},(err)=>{ | ||
console.log("写入成功"); | ||
}); | ||
|
||
|
||
console.log("读取文件成功"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fs=require("fs"); | ||
|
||
//重命名 | ||
/*fs.rename("./1.txt","./11.txt",(err)=>{ | ||
if(!err) console.log("重命名成功"); | ||
});*/ | ||
//判断文件是否存在 | ||
var res=fs.existsSync("./2.txt"); | ||
console.log(res); | ||
|
||
//获取文件基本信息 | ||
fs.stat("./2.txt",(err,stats)=>{ | ||
if(err){ | ||
console.log("获取信息失败"); | ||
return false; | ||
} | ||
|
||
console.log(stats); | ||
|
||
}); | ||
//删除文件 | ||
if(fs.existsSync("./11.txt")){ | ||
fs.unlink("./11.txt"); | ||
} | ||
|
||
if(!fs.existsSync("./c")){ | ||
fs.mkdir("./c"); | ||
} | ||
|
||
|
||
fs.readdir(".",(err,files)=>{ | ||
console.log(files); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const path=require("path"); | ||
const fs=require("fs"); | ||
|
||
|
||
|
||
let lujing="E:\\node_study\\code\\0403\\2.txt"; | ||
let lujing1="E:\\node_study\\code\\0403\\"; | ||
|
||
|
||
|
||
|
||
console.log(path.basename(lujing)); | ||
console.log(path.extname(lujing)); | ||
console.log(path.dirname(lujing1)); | ||
|
||
fs.readdir(lujing1,(err,files)=>{ | ||
console.log(files); | ||
}); | ||
|
||
let newlujing=path.join("a","b","c","..","g/f/e/d",".."); | ||
|
||
|
||
console.log(newlujing); | ||
|
||
let pathObj=path.parse(lujing); | ||
console.log(pathObj); | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
在读写文件 或者网络传输 数据 | ||
字符串 buffer 二进制数据 | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const events = require('events'); | ||
|
||
|
||
const myEmitter = new events(); | ||
|
||
|
||
myEmitter.on('fangxue', () => { | ||
console.log('吃饭去'); | ||
}); | ||
|
||
myEmitter.emit('fangxue'); | ||
myEmitter.emit('fangxue'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const path=require("path"); | ||
|
||
console.log(__dirname); | ||
console.log(__filename); | ||
|
||
console.log(path.extname(__filename)); |
Submodule electron-quick-start
added at
71199c