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

Function write

packages/arctic/src/storage/storage.ts:193–200  ·  view source on GitHub ↗
(key: string[], content: T)

Source from the content-addressed store, hash-verified

191 }
192
193 export async function write<T>(key: string[], content: T) {
194 const dir = await state().then((x) => x.dir)
195 const target = path.join(dir, ...key) + ".json"
196 return withErrorHandling(async () => {
197 using _ = await Lock.write(target)
198 await Bun.write(target, JSON.stringify(content, null, 2))
199 })
200 }
201
202 async function withErrorHandling<T>(body: () => Promise<T>) {
203 return body().catch((e) => {

Callers

nothing calls this directly

Calls 2

stateFunction · 0.85
withErrorHandlingFunction · 0.85

Tested by

no test coverage detected