Title: @wordpress/blob
Published: March 9, 2021
Last modified: October 14, 2026

---

# @wordpress/blob

## In this article

 * [Installation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#installation)
 * [API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#api)
    - [createBlobURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#createbloburl)
    - [downloadBlob](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#downloadblob)
    - [getBlobByURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#getblobbyurl)
    - [getBlobTypeByURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#getblobtypebyurl)
    - [isBlobURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#isbloburl)
    - [revokeBlobURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#revokebloburl)
 * [Contributing to this package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#contributing-to-this-package)

Blob utilities for WordPress.

## 󠀁[Installation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#installation)󠁿

Install the module

    ```bash
    npm install @wordpress/blob --save
    ```

## 󠀁[API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#api)󠁿

### 󠀁[createBlobURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#createbloburl)󠁿

Create a blob URL from a file.

_Parameters_

 * _file_ `File`: The file to create a blob URL for.

_Returns_

 * `string`: The blob URL.

### 󠀁[downloadBlob](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#downloadblob)󠁿

Downloads a file, e.g., a text or readable stream, in the browser. Appropriate for
downloading smaller file sizes, e.g., \< 5 MB.

Example usage:

    ```javascript
    const fileContent = JSON.stringify(
        {
            title: 'My Post',
        },
        null,
        2
    );
    const filename = 'file.json';

    downloadBlob( filename, fileContent, 'application/json' );
    ```

_Parameters_

 * _filename_ `string`: File name.
 * _content_ `BlobPart`: File content (BufferSource | Blob | string).
 * _contentType_ `string`: (Optional) File mime type. Default is `''`.

### 󠀁[getBlobByURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#getblobbyurl)󠁿

Retrieve a file based on a blob URL. The file must have been created by `createBlobURL`
and not removed by `revokeBlobURL`, otherwise it will return `undefined`.

_Parameters_

 * _url_ `string`: The blob URL.

_Returns_

 * `File | undefined`: The file for the blob URL.

### 󠀁[getBlobTypeByURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#getblobtypebyurl)󠁿

Retrieve a blob type based on URL. The file must have been created by `createBlobURL`
and not removed by `revokeBlobURL`, otherwise it will return `undefined`.

_Parameters_

 * _url_ `string`: The blob URL.

_Returns_

 * `string | undefined`: The blob type.

### 󠀁[isBlobURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#isbloburl)󠁿

Check whether a url is a blob url.

_Parameters_

 * _url_ `string | undefined`: The URL.

_Returns_

 * `boolean`: Is the url a blob url?

### 󠀁[revokeBlobURL](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#revokebloburl)󠁿

Remove the resource and file cache from memory.

_Parameters_

 * _url_ `string`: The blob URL.

## 󠀁[Contributing to this package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blob/?output_format=md#contributing-to-this-package)󠁿

This is an individual package that’s part of the Gutenberg project. The project 
is organized as a monorepo. It’s made up of multiple self-contained software packages,
each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/)
and used by [WordPress](https://make.wordpress.org/core/) as well as other software
projects.

To find out more about contributing to this package or Gutenberg as a whole, please
read the project’s main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).

First published

March 9, 2021

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: @wordpress/blob ](https://github.com/WordPress/gutenberg/edit/trunk/packages/blob/README.md)

[  Previous: @wordpress/base-styles](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-base-styles/)

[  Next: @wordpress/block-directory](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-directory/)