From bc65eb27814ec812b8eafcfbed7251b5fa06ded1 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 17 Jun 2022 23:09:14 +0800 Subject: [PATCH] Update use file modify instead of fs write --- Upload2Notion.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Upload2Notion.ts b/Upload2Notion.ts index 5f56772..f40dfee 100644 --- a/Upload2Notion.ts +++ b/Upload2Notion.ts @@ -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}`) + } }