Documentation / base / guessMimeType
Function: guessMimeType()
guessMimeType(
path):string
Defined in: libs/base/src/vfs/common.ts:311
Guesses the MIME type based on a file path or file name.
Behavior:
- Uses
PathUtils.extnameto extract the extension (case-insensitive). - Falls back to
application/octet-streamif unknown.
Notes:
- The mapping is intentionally minimal and web-oriented.
- Extend the
mimeTypestable if you need additional types.
Examples:
- guessMimeType('image.png') -> 'image/png'
- guessMimeType('/a/b/model.glb') -> 'model/gltf-binary'
- guessMimeType('unknown.ext') -> 'application/octet-stream'
Parameters
path
string
File path or name used to infer the MIME type.
Returns
string
The guessed MIME type string.