# image/imageupload/utils

module

<a id="functions">

## Functions

<a id="function-createImageTypeRegExp">

### `createImageTypeRegExp( types ) → RegExp`

Creates a regular expression used to test for image files.

```typescript
const imageType = createImageTypeRegExp( [ 'png', 'jpeg', 'svg+xml', 'vnd.microsoft.icon' ] );

console.log( 'is supported image', imageType.test( file.type ) );
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-image/src/imageupload/utils.ts#L23)

#### Parameters

* `types: Array<string>`

#### Returns

* `RegExp`

<a id="function-fetchLocalImage">

### `fetchLocalImage( image ) → Promise<File>` _(internal)_

Creates a promise that fetches the image local source (Base64 or blob) and resolves with a `File` object.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-image/src/imageupload/utils.ts#L38)

#### Parameters

* `image: ViewElement`

  Image whose source to fetch.

#### Returns

* `Promise<File>`

  A promise which resolves when an image source is fetched and converted to a `File` instance. It resolves with a `File` object. If there were any errors during file processing, the promise will be rejected.

<a id="function-isLocalImage">

### `isLocalImage( imageUtils, node ) → boolean` _(internal)_

Checks whether a given node is an image element with a local source (Base64 or blob).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-image/src/imageupload/utils.ts#L70)

#### Parameters

* `imageUtils: ImageUtils`

* `node: ViewElement`

  The node to check.

#### Returns

* `boolean`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
