Update use file modify instead of fs write

This commit is contained in:
chris
2022-06-17 23:09:14 +08:00
parent 22d2f79612
commit bc65eb2781

View File

@@ -121,10 +121,14 @@ export class Upload2Notion {
// if __content have start \n remove it
const __content_remove_n = __content.replace(/^\n/, '')
const content = '---\n' +yamlhead_remove_n +'\n---\n' + __content_remove_n;
const fullPath = this.getFilePath(nowFile);
// const fullPath = this.getFilePath(nowFile);
//write content fo file
fs.writeFileSync(fullPath, content);
console.log(res)
// fs.writeFileSync(fullPath, content);
try {
await nowFile.vault.modify(nowFile, content)
} catch (error) {
new Notice(`write file error ${error}`)
}
}