obsidian-dev-utils
Version:
This is the collection of useful functions that you can use for your Obsidian plugin development
42 lines (41 loc) • 1.39 kB
text/typescript
/**
* @packageDocumentation
*
* Contains utility functions for Blob objects.
*/
/**
* Converts a {@link Blob} object to an {@link ArrayBuffer}.
*
* @param blob - The Blob object to convert.
* @returns A {@link Promise} that resolves to an {@link ArrayBuffer}.
*/
export declare function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
/**
* Converts a {@link Blob} object to a data URL.
*
* @param blob - The Blob object to convert.
* @returns A {@link Promise} that resolves to a data URL.
*/
export declare function blobToDataUrl(blob: Blob): Promise<string>;
/**
* Converts a {@link Blob} object to a JPEG ArrayBuffer with the specified quality.
*
* @param blob - The Blob object to convert.
* @param jpegQuality - The quality of the JPEG image (0 to 1).
* @returns A {@link Promise} that resolves to an {@link ArrayBuffer}.
*/
export declare function blobToJpegArrayBuffer(blob: Blob, jpegQuality: number): Promise<ArrayBuffer>;
/**
* Converts a base64 encoded string to an {@link ArrayBuffer}.
*
* @param dataUrl - The data URL to convert.
* @returns The decoded ArrayBuffer.
*/
export declare function dataUrlToArrayBuffer(dataUrl: string): ArrayBuffer;
/**
* Checks if a given file is an image.
*
* @param file - The file to check.
* @returns True if the file is an image, false otherwise.
*/
export declare function isImageFile(file: File): boolean;