# Media

## Overview

The `Media` class represents binary data associated with a MIME type and provides various methods to manage and manipulate this data. It stores media content as a blob and offers functionality for retrieving and updating the media content, such as using the `getMediaData()` function to lazily load the media or `makeBlobPermanent()` to make the data persistent. The class also allows for setting and getting properties like `name` and `mime type` through the `setName()` and `getMimeType()` functions, ensuring proper i dentification of the media.

Additionally, the `Media` class supports encapsulation levels with `setEncapsulation()` and `getEncapsulation()`, which help define how the media is exposed in different environments. The class also includes methods for handling deprecation, allowing you to track and manage deprecated media through `getDeprecated()` and `setDeprecated()`.

By utilizing these features, the `Media` class provides support for managing media data, making it easy to handle in the Servoy environment, whether it is for temporary usage or permanent storage with a defined MIME type.

## Properties Summarized

| Type                                                     | Name                            | Summary                                                                                         |
| -------------------------------------------------------- | ------------------------------- | ----------------------------------------------------------------------------------------------- |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [comment](#comment)             | Additional design time information, such as programmer notes about this model object's purpose. |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [deprecated](#deprecated)       | Gets the deprecation info for this element.                                                     |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [encapsulation](#encapsulation) | The encapsulation mode of this Media.                                                           |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [mimeType](#mimetype)           | The MIME type of the Media object.                                                              |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [name](#name)                   | The name of the Media object.                                                                   |

## Properties Detailed

### comment

Additional design time information, such as programmer notes about this model object's purpose.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

### deprecated

Gets the deprecation info for this element.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) the deprecation info for this object or null if it is not deprecated

**Sample**

```js
"not used anymore, replaced with ..."
```

### encapsulation

The encapsulation mode of this Media. The following can be used:

\- Public (available in both scripting and designer from any module)\
\- Module Scope - available in both scripting and designer but only in the same module.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md) the encapsulation mode/level of the persist.

### mimeType

The MIME type of the Media object.

Some examples are: 'image/jpg', 'image/png', etc.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

### name

The name of the Media object.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/object-model/solution/media.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
