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

Function isBinaryContentType

src/utils/mcpOutputStorage.ts:125–136  ·  view source on GitHub ↗
(contentType: string)

Source from the content-addressed store, hash-verified

123 * Text-ish types (text/*, json, xml, form data) are treated as non-binary.
124 */
125export function isBinaryContentType(contentType: string): boolean {
126 if (!contentType) return false
127 const mt = (contentType.split(';')[0] ?? '').trim().toLowerCase()
128 if (mt.startsWith('text/')) return false
129 // Structured text formats delivered with an application/ type. Use suffix
130 // or exact match rather than substring so 'openxmlformats' (docx/xlsx) stays binary.
131 if (mt.endsWith('+json') || mt === 'application/json') return false
132 if (mt.endsWith('+xml') || mt === 'application/xml') return false
133 if (mt.startsWith('application/javascript')) return false
134 if (mt === 'application/x-www-form-urlencoded') return false
135 return true
136}
137
138export type PersistBinaryResult =
139 | { filepath: string; size: number; ext: string }

Callers 1

getURLMarkdownContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected