LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsbackendsgetMimeType
Function●Since v1.9

getMimeType

Copy
getMimeType(filePath: string): string
View source on GitHub

Parameters

NameTypeDescription
filePath*string

Determine MIME type from a file path's extension.

Defaults to "text/plain" for unknown extensions. Only the known non-text formats above (images, audio, video, PDF/PPT) are treated as binary by isTextMimeType; everything else reads as text, including source files with uncommon extensions (.properties, .scss, .tf) and extension-less files (Dockerfile, mvnw). This avoids base64-encoding text into document blocks, which the model can't read and which the Anthropic provider rejects with a 400.

File path to inspect