MCPcopy Create free account
hub / github.com/142vip/408CSFamily / quickCreateMdFile

Function quickCreateMdFile

docs/quickCreateMdFile.js:42–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40const { prefix, children } = sideBarData
41
42async function quickCreateMdFile() {
43 /**
44 * 第一步: 创建目录
45 */
46 const dir = VipNodeJS.pathJoin(__dirname, prefix)
47 const isExist = VipNodeJS.existPath(dir)
48
49 if (!isExist) {
50 await fs.mkdirSync(dir)
51 }
52
53 /**
54 * 第二步: 创建文件,并追加文件内容
55 */
56
57 for (const { text, link } of children) {
58 const filePath = VipNodeJS.pathJoin(dir, link)
59 const isExistFile = VipNodeJS.existPath(filePath)
60 // 创建
61 if (!isExistFile) {
62 await VipNodeJS.writeFileByUTF8(filePath, `# ${text} \n\n努力赶稿中,等等我呀...`)
63 }
64 }
65}
66
67void quickCreateMdFile()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected