vaultmd / createVault
Function: createVault()
createVault(
config):Promise<Vault>
Defined in: src/vault/create-vault.ts:42
Open (or create) a vault over a folder of markdown notes. Wires the IO chokepoint, the derived SQLite index, and the query/notes layers into one Vault. The .md files on disk remain the single source of truth; the index is a rebuildable cache.
Parameters
config
Vault configuration — at minimum root, indexPath, and prefixes.
Returns
Promise<Vault>
A ready-to-use Vault handle. Call Vault.close when done.
Example
ts
const vault = await createVault({
root: './notes',
// Keep the index db outside the synced vault.
indexPath: './data/vault-index.db',
prefixes: { read: [''], write: [''] },
});
const hits = vault.query.queryNotes({ tag: 'project' });
vault.close();