[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> blob.js (summary)

(no description)

File Size: 157 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  createBlobURL()
  getBlobByURL()
  getBlobTypeByURL()
  revokeBlobURL()
  isBlobURL()
  downloadBlob()

Functions
Functions that are not part of a class:

createBlobURL(file)   X-Ref
Create a blob URL from a file.

param: file The file to create a blob URL for.
return: The blob URL.

getBlobByURL(url)   X-Ref
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`.

param: url The blob URL.
return: The file for the blob URL.

getBlobTypeByURL(url)   X-Ref
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`.

param: url The blob URL.
return: The blob type.

revokeBlobURL(url)   X-Ref
Remove the resource and file cache from memory.

param: url The blob URL.

isBlobURL(url)   X-Ref
Check whether a url is a blob url.

param: url The URL.
return: Is the url a blob url?

downloadBlob(filename, content, contentType = '')   X-Ref
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:

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

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

param: filename    File name.
param: content     File content (BufferSource | Blob | string).
param: contentType (Optional) File mime type. Default is `''`.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref