Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9a8b781

Browse files
committed
create write file, readwrite file
1 parent4e57617 commit9a8b781

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

‎src/services/write.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import*asfsfrom'fs';
2+
import*aspathfrom'path';
3+
4+
functiongetPath(filePath:string){
5+
returnpath.normalize(path.join(window.coderoad.dir,filePath));
6+
}
7+
8+
exportfunctionwrite(filePath:string,text){
9+
try{
10+
fs.writeFileSync(getPath(filePath),text,'utf8');
11+
}catch(e){
12+
if(e){console.log('Error writing to filePath',filePath);}
13+
}
14+
}
15+
16+
exportfunctionreadWrite(writePath:string,readPath:string){
17+
try{
18+
write(writePath,fs.readFileSync(getPath(readPath)));
19+
}catch(e){
20+
if(e){console.log('Error reading from filePath',readPath);}
21+
}
22+
}

‎tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"src/services/setup-actions.ts",
9696
"src/services/setup-checks.ts",
9797
"src/services/tutorials.ts",
98+
"src/services/write.ts",
9899
"src/store/initialState.ts",
99100
"src/store/store.ts",
100101
"src/components/account/account.tsx",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp