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

Function readSidecar

apps/desktop/src/main/databases.ts:115–126  ·  view source on GitHub ↗
(root: string, rel: string)

Source from the content-addressed store, hash-verified

113}
114
115async function readSidecar(root: string, rel: string): Promise<DatabaseSidecar | null> {
116 try {
117 const raw = await fs.readFile(databaseSidecarPath(root, rel), 'utf8')
118 const sidecar = normalizeSidecar(JSON.parse(raw))
119 if (sidecar?.pages) sidecar.pages = pagesToFull(toPosix(rel), sidecar.pages)
120 return sidecar
121 } catch (err) {
122 if (isMissing(err)) return null
123 if (err instanceof SyntaxError) return null
124 throw err
125 }
126}
127
128function hydrate(
129 rel: string,

Callers 2

readDatabaseFunction · 0.85
writeDatabaseRowsFunction · 0.85

Calls 5

databaseSidecarPathFunction · 0.90
normalizeSidecarFunction · 0.85
pagesToFullFunction · 0.85
isMissingFunction · 0.85
toPosixFunction · 0.70

Tested by

no test coverage detected