@nogoo9/mcp-server-cloud-fs / inferContentType
Function: inferContentType()
inferContentType(
key,content):Promise<string>
Defined in: providers/content-type.ts:103
Infer content type from buffer magic bytes, falling back to file extension.
Uses the file-type library for robust magic-byte detection (100+ types). Text formats (.txt, .md, .json, etc.) have no magic numbers — they are handled by the extension fallback without raising an error.
Parameters
key
string
The object key / filename (used for extension lookup).
content
Buffer
The file content buffer (used for magic-byte sniffing).
Returns
Promise<string>
A MIME type string, or "application/octet-stream" if unknown.
