MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / appendToNote

Function appendToNote

apps/web/src/bridge/http-bridge.ts:408–421  ·  view source on GitHub ↗
(
  relPath: string,
  body: string,
  position: 'start' | 'end'
)

Source from the content-addressed store, hash-verified

406}
407
408async function appendToNote(
409 relPath: string,
410 body: string,
411 position: 'start' | 'end'
412): Promise<NoteMeta> {
413 const current = await readNote(relPath)
414 const trimmed = body.replace(/\s+$/u, '')
415 if (!trimmed) return current
416 const next =
417 position === 'end'
418 ? `${current.body}${current.body.endsWith('\n') ? '' : '\n'}\n${trimmed}\n`
419 : `${trimmed}\n\n${current.body}`
420 return await writeNote(relPath, next)
421}
422
423function createNote(
424 folder: NoteFolder,

Callers

nothing calls this directly

Calls 2

readNoteFunction · 0.70
writeNoteFunction · 0.70

Tested by

no test coverage detected