MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / storePastedText

Function storePastedText

source code/utils/pasteStore.ts:39–55  ·  view source on GitHub ↗
(
  hash: string,
  content: string,
)

Source from the content-addressed store, hash-verified

37 * can use it immediately without waiting for the async disk write.
38 */
39export async function storePastedText(
40 hash: string,
41 content: string,
42): Promise<void> {
43 try {
44 const dir = getPasteStoreDir()
45 await mkdir(dir, { recursive: true })
46
47 const pastePath = getPastePath(hash)
48
49 // Content-addressable: same hash = same content, so overwriting is safe
50 await writeFile(pastePath, content, { encoding: 'utf8', mode: 0o600 })
51 logForDebugging(`Stored paste ${hash} to ${pastePath}`)
52 } catch (error) {
53 logForDebugging(`Failed to store paste: ${error}`)
54 }
55}
56
57/**
58 * Retrieve pasted text content by its hash.

Callers 1

addToPromptHistoryFunction · 0.85

Calls 4

getPasteStoreDirFunction · 0.85
mkdirFunction · 0.85
getPastePathFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected