mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-31 01:48:35 +08:00
Update use file modify instead of fs write
This commit is contained in:
@@ -121,10 +121,14 @@ export class Upload2Notion {
|
|||||||
// if __content have start \n remove it
|
// if __content have start \n remove it
|
||||||
const __content_remove_n = __content.replace(/^\n/, '')
|
const __content_remove_n = __content.replace(/^\n/, '')
|
||||||
const content = '---\n' +yamlhead_remove_n +'\n---\n' + __content_remove_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
|
//write content fo file
|
||||||
fs.writeFileSync(fullPath, content);
|
// fs.writeFileSync(fullPath, content);
|
||||||
console.log(res)
|
try {
|
||||||
|
await nowFile.vault.modify(nowFile, content)
|
||||||
|
} catch (error) {
|
||||||
|
new Notice(`write file error ${error}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user