MCPcopy Create free account
hub / github.com/arctic-cli/interface / read

Function read

packages/arctic/src/storage/storage.ts:168–179  ·  view source on GitHub ↗
(key: string[])

Source from the content-addressed store, hash-verified

166 }
167
168 export async function read<T>(key: string[]) {
169 const dir = await state().then((x) => x.dir)
170 const target = path.join(dir, ...key) + ".json"
171 return withErrorHandling(async () => {
172 using _ = await Lock.read(target)
173 const result = await Bun.file(target).json().catch((e) => {
174 log.error("failed to parse JSON", { target, error: e.message })
175 throw e
176 })
177 return result as T
178 })
179 }
180
181 export async function update<T>(key: string[], fn: (draft: T) => void) {
182 const dir = await state().then((x) => x.dir)

Callers

nothing calls this directly

Calls 4

stateFunction · 0.85
withErrorHandlingFunction · 0.85
jsonMethod · 0.65
readMethod · 0.45

Tested by

no test coverage detected