MCPcopy Create free account
hub / github.com/arktypeio/arktype / write

Method write

ark/aot/cache.ts:240–249  ·  view source on GitHub ↗
(name: string, body: string)

Source from the content-addressed store, hash-verified

238 // reads all of it or none, and the last of two writing it wins. Its temp
239 // file is new, as one already there may link to a file outside the cache
240 private write(name: string, body: string): void {
241 const path = join(this.dir, `${name}.json`)
242 const temp = `${path}.${process.pid}-${threadId}.tmp`
243 try {
244 writeFileSync(temp, `${hashOf(body)}\n${body}`, { flag: "wx" })
245 renameSync(temp, path)
246 } catch {
247 rmSync(temp, { force: true })
248 }
249 }
250}
251
252export interface SnapshotCheck {

Callers 2

setMethod · 0.95
addSnapshotMethod · 0.95

Calls 2

joinFunction · 0.85
hashOfFunction · 0.70

Tested by

no test coverage detected