(root: string, rel: string, body: string)
| 567 | } |
| 568 | |
| 569 | export async function writeNote(root: string, rel: string, body: string): Promise<NoteMeta> { |
| 570 | const abs = resolveSafe(root, rel) |
| 571 | await fs.mkdir(path.dirname(abs), { recursive: true }) |
| 572 | await fs.writeFile(abs, body, 'utf8') |
| 573 | const folder = folderOf(root, abs) |
| 574 | if (!folder) throw new Error(`Note not in a known folder: ${rel}`) |
| 575 | return await readMeta(root, abs, folder) |
| 576 | } |
| 577 | |
| 578 | async function uniqueTitle(dir: string, base: string): Promise<string> { |
| 579 | let candidate = base |
no test coverage detected