MCPcopy Create free account
hub / github.com/garrytan/gstack / mimeToExt

Function mimeToExt

browse/src/write-commands.ts:1430–1440  ·  view source on GitHub ↗

Map MIME type to file extension.

(mime: string)

Source from the content-addressed store, hash-verified

1428
1429/** Map MIME type to file extension. */
1430function mimeToExt(mime: string): string {
1431 const map: Record<string, string> = {
1432 'image/png': '.png', 'image/jpeg': '.jpg', 'image/gif': '.gif',
1433 'image/webp': '.webp', 'image/svg+xml': '.svg', 'image/avif': '.avif',
1434 'video/mp4': '.mp4', 'video/webm': '.webm', 'video/quicktime': '.mov',
1435 'audio/mpeg': '.mp3', 'audio/wav': '.wav', 'audio/ogg': '.ogg',
1436 'application/pdf': '.pdf', 'application/json': '.json',
1437 'text/html': '.html', 'text/plain': '.txt',
1438 };
1439 return map[mime] || '.bin';
1440}

Callers 1

handleWriteCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected