For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
      • Get Asset Name
      • Set Asset Name
      • Get Alt Text
      • Set Alt Text
      • Set Asset File
      • Get Asset MIME Type
      • Get Asset URL
      • Get folder of Asset
      • Set folder for Asset
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • asset.getMimeType()
  • Syntax
  • Returns
  • Example
  • Designer Ability
AssetsManaging Assets

Get Asset MIME Type

Was this page helpful?
Previous

Get Asset URL

Next
Built with

asset.getMimeType()

Retrieve the MIME Type of a specified asset.

Syntax

1asset.getMimeType(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the MIME type of the Asset

Example

1// Get Selected Element
2const el = await webflow.getSelectedElement()
3
4// Check if element is selected and its type
5if (!el || el.type !== 'Image') {
6 console.error('Please select an Image element on the canvas')
7 await webflow.notify({
8 type: 'Error',
9 message: 'Please select an Image element on the canvas',
10 })
11} else {
12 const asset = await el.getAsset() // Get Asset
13 const assetMimeType = await asset?.getMimeType() // Get Asset MIME Type
14 console.log(`Asset MIME type: ${assetMimeType}`)
15}

Try this example

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessAssetsanyanyanyany