Why does fs.writeFile not save file?

getAbstractFileByPath always returned null if path included a hidden folder (e.g. : .obsidian). Not sure what I am doing wrong.

So I decided to use app.vault.adapter.exists instead.

To create and overwrite a file, I just use app.vault.adapter.write. To read it if it exists, app.vault.adapter.read.

Not sure if it is the proper way to read/write files inside an Obsidian vault, but it seems to work here (so far I’ve only been able to test on Windows, Android 12 and iPad).

2 Likes