MCPcopy
hub / github.com/codeaashu/claude-code / storePastedText

Function storePastedText

src/utils/pasteStore.ts:37–53  ·  view source on GitHub ↗
(
  hash: string,
  content: string,
)

Source from the content-addressed store, hash-verified

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