MCPcopy
hub / github.com/anomalyco/opencode / assertAttachmentBudget

Function assertAttachmentBudget

packages/desktop/src/main/attachment-picker.ts:33–37  ·  view source on GitHub ↗
(files: { size: number }[])

Source from the content-addressed store, hash-verified

31}
32
33export function assertAttachmentBudget(files: { size: number }[]) {
34 const total = files.reduce((sum, file) => sum + file.size, 0)
35 if (total <= MAX_ATTACHMENT_BYTES) return
36 throw new Error(`Selected attachments exceed the ${MAX_ATTACHMENT_BYTES / 1024 / 1024} MB limit`)
37}
38
39export async function readAttachment(filePath: string, maxBytes = MAX_ATTACHMENT_BYTES) {
40 const file = await open(filePath, "r")

Callers 2

registerIpcHandlersFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected