(root: string, rel: string)
| 558 | /* ---------- Read / write / create ------------------------------------ */ |
| 559 | |
| 560 | export async function readNote(root: string, rel: string): Promise<NoteContent> { |
| 561 | const abs = resolveSafe(root, rel) |
| 562 | const folder = folderOf(root, abs) |
| 563 | if (!folder) throw new Error(`Note not in a known folder: ${rel}`) |
| 564 | const body = await fs.readFile(abs, 'utf8') |
| 565 | const meta = await readMeta(root, abs, folder) |
| 566 | return { ...meta, body } |
| 567 | } |
| 568 | |
| 569 | export async function writeNote(root: string, rel: string, body: string): Promise<NoteMeta> { |
| 570 | const abs = resolveSafe(root, rel) |
no test coverage detected