Socket
Socket
Sign inDemoInstall

@wordpress/blob

Package Overview
Dependencies
Maintainers
24
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/blob - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

src/index.ts

27

build-module/index.js

@@ -1,4 +0,1 @@

/**
* @type {Record<string, File|undefined>}
*/
const cache = {};

@@ -9,5 +6,5 @@

*
* @param {File} file The file to create a blob URL for.
* @param file The file to create a blob URL for.
*
* @return {string} The blob URL.
* @return The blob URL.
*/

@@ -25,5 +22,5 @@ export function createBlobURL(file) {

*
* @param {string} url The blob URL.
* @param url The blob URL.
*
* @return {File|undefined} The file for the blob URL.
* @return The file for the blob URL.
*/

@@ -39,5 +36,5 @@ export function getBlobByURL(url) {

*
* @param {string} url The blob URL.
* @param url The blob URL.
*
* @return {string|undefined} The blob type.
* @return The blob type.
*/

@@ -51,3 +48,3 @@ export function getBlobTypeByURL(url) {

*
* @param {string} url The blob URL.
* @param url The blob URL.
*/

@@ -64,5 +61,5 @@ export function revokeBlobURL(url) {

*
* @param {string|undefined} url The URL.
* @param url The URL.
*
* @return {boolean} Is the url a blob url?
* @return Is the url a blob url?
*/

@@ -95,5 +92,5 @@ export function isBlobURL(url) {

*
* @param {string} filename File name.
* @param {BlobPart} content File content (BufferSource | Blob | string).
* @param {string} contentType (Optional) File mime type. Default is `''`.
* @param filename File name.
* @param content File content (BufferSource | Blob | string).
* @param contentType (Optional) File mime type. Default is `''`.
*/

@@ -100,0 +97,0 @@ export function downloadBlob(filename, content, contentType = '') {

/**
* Create a blob URL from a file.
*
* @param {File} file The file to create a blob URL for.
* @param file The file to create a blob URL for.
*
* @return {string} The blob URL.
* @return The blob URL.
*/
export function createBlobURL(file: File): string;
export declare function createBlobURL(file: File): string;
/**

@@ -14,7 +14,7 @@ * Retrieve a file based on a blob URL. The file must have been created by

*
* @param {string} url The blob URL.
* @param url The blob URL.
*
* @return {File|undefined} The file for the blob URL.
* @return The file for the blob URL.
*/
export function getBlobByURL(url: string): File | undefined;
export declare function getBlobByURL(url: string): File | undefined;
/**

@@ -25,21 +25,21 @@ * Retrieve a blob type based on URL. The file must have been created by

*
* @param {string} url The blob URL.
* @param url The blob URL.
*
* @return {string|undefined} The blob type.
* @return The blob type.
*/
export function getBlobTypeByURL(url: string): string | undefined;
export declare function getBlobTypeByURL(url: string): string | undefined;
/**
* Remove the resource and file cache from memory.
*
* @param {string} url The blob URL.
* @param url The blob URL.
*/
export function revokeBlobURL(url: string): void;
export declare function revokeBlobURL(url: string): void;
/**
* Check whether a url is a blob url.
*
* @param {string|undefined} url The URL.
* @param url The URL.
*
* @return {boolean} Is the url a blob url?
* @return Is the url a blob url?
*/
export function isBlobURL(url: string | undefined): boolean;
export declare function isBlobURL(url: string | undefined): boolean;
/**

@@ -64,7 +64,7 @@ * Downloads a file, e.g., a text or readable stream, in the browser.

*
* @param {string} filename File name.
* @param {BlobPart} content File content (BufferSource | Blob | string).
* @param {string} contentType (Optional) File mime type. Default is `''`.
* @param filename File name.
* @param content File content (BufferSource | Blob | string).
* @param contentType (Optional) File mime type. Default is `''`.
*/
export function downloadBlob(filename: string, content: BlobPart, contentType?: string): void;
export declare function downloadBlob(filename: string, content: BlobPart, contentType?: string): void;
//# sourceMappingURL=index.d.ts.map

@@ -12,5 +12,2 @@ "use strict";

exports.revokeBlobURL = revokeBlobURL;
/**
* @type {Record<string, File|undefined>}
*/
const cache = {};

@@ -21,5 +18,5 @@

*
* @param {File} file The file to create a blob URL for.
* @param file The file to create a blob URL for.
*
* @return {string} The blob URL.
* @return The blob URL.
*/

@@ -37,5 +34,5 @@ function createBlobURL(file) {

*
* @param {string} url The blob URL.
* @param url The blob URL.
*
* @return {File|undefined} The file for the blob URL.
* @return The file for the blob URL.
*/

@@ -51,5 +48,5 @@ function getBlobByURL(url) {

*
* @param {string} url The blob URL.
* @param url The blob URL.
*
* @return {string|undefined} The blob type.
* @return The blob type.
*/

@@ -63,3 +60,3 @@ function getBlobTypeByURL(url) {

*
* @param {string} url The blob URL.
* @param url The blob URL.
*/

@@ -76,5 +73,5 @@ function revokeBlobURL(url) {

*
* @param {string|undefined} url The URL.
* @param url The URL.
*
* @return {boolean} Is the url a blob url?
* @return Is the url a blob url?
*/

@@ -107,5 +104,5 @@ function isBlobURL(url) {

*
* @param {string} filename File name.
* @param {BlobPart} content File content (BufferSource | Blob | string).
* @param {string} contentType (Optional) File mime type. Default is `''`.
* @param filename File name.
* @param content File content (BufferSource | Blob | string).
* @param contentType (Optional) File mime type. Default is `''`.
*/

@@ -112,0 +109,0 @@ function downloadBlob(filename, content, contentType = '') {

@@ -5,2 +5,8 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 4.1.0 (2024-06-15)
### Internal
- Refactor to TypeScript ([#62569](https://github.com/WordPress/gutenberg/pull/62569)).
## 4.0.0 (2024-05-31)

@@ -7,0 +13,0 @@

{
"name": "@wordpress/blob",
"version": "4.0.1",
"version": "4.1.0",
"description": "Blob utilities for WordPress.",

@@ -36,3 +36,3 @@ "author": "The WordPress Contributors",

},
"gitHead": "0e973525f7787401b5a544e0727774d52a78639f"
"gitHead": "66d3bf12e67d16deddc4b4a9ec42e1d0bed3479a"
}

@@ -64,3 +64,3 @@ # Blob

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

@@ -77,3 +77,3 @@ ### getBlobTypeByURL

- `string|undefined`: The blob type.
- `string | undefined`: The blob type.

@@ -86,3 +86,3 @@ ### isBlobURL

- _url_ `string|undefined`: The URL.
- _url_ `string | undefined`: The URL.

@@ -89,0 +89,0 @@ _Returns_

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc