[ 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.

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

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`.

return: The file for the blob URL.
param: url 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`.

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

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.

return: Is the url a blob url?
param: url The 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 : Sun Dec 22 08:20:01 2024 Cross-referenced by PHPXref