obsidianmd / obsidianmd/obsidian-developer-docs
Clarify Vault API limitations working w/ hidden (dot) directories
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 521
- Forks
- 174
- PR merge metrics
- No merged PRs in 30d
Description
Context
Spent quite some time today trying to figure out why I couldn't access anything inside .obsidian using the Vault API (namely, getFileByPath()/getAbstractFileByPath()) until I asked on Discord and figured the way to go was using DataAdapter (vault.adapter).
Issue
I tested every function in the Vault API that takes a path as a parameter and tried manipulating test files/folders inside the .obsidian path. Functions that create or copy a file/folder do what they're meant to do, but return null instead of the relevant object.
| Function name | Status |
|---|---|
| rename | 🟢 Works normally |
| create | 🟡 Works partially |
| createBinary | 🟡 Works partially |
| createFolder | 🟡 Works partially |
| copy | 🟡 Works partially |
| getFolderByPath | 🔴 Doesn't work at all |
| getAbstractFileByPath | 🔴 Doesn't work at all |
| getFileByPath | 🔴 Doesn't work at all |
Proposal
Document this behavior in the reference for the relevant functions and in the main Vault docs, suggesting the use of DataAdapter instead of the Vault API for hidden files.
Proposed wording
Based on how it's written in the DataAdapter documentation
Work directly with files and folders inside a vault. If possible prefer using the Vault API over this.
I suggest we append to each relevant page's description the following phrase:
Prefer using DataAdapter when working with hidden files and folders, such as those inside
.obsidian.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TypeScript API Vault reference and the DataAdapter documentation linked in the issue, then review the pages for the listed Vault functions. Document the observed behavior for hidden files and folders and add guidance to prefer DataAdapter, including the main Vault docs; done means the relevant references clearly cover these limitations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100