taglib-wasm
Version:
TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps
32 lines • 1.18 kB
TypeScript
import type { Picture, PictureType } from "../types.js";
/**
* Convert a Picture object to a data URL for display in web browsers
*
* @param picture - Picture object from TagLib-Wasm
* @returns Data URL string that can be used as src for <img> elements
*
* @example
* ```typescript
* const pictures = await readPictures("song.mp3");
* const imgElement = document.getElementById('coverArt') as HTMLImageElement;
* imgElement.src = pictureToDataURL(pictures[0]);
* ```
*/
export declare function pictureToDataURL(picture: Picture): string;
/**
* Convert a data URL to a Picture object
*
* @param dataURL - Data URL string (e.g., "data:image/jpeg;base64,...")
* @param type - Picture type (defaults to FrontCover)
* @param description - Optional description
* @returns Picture object
*
* @example
* ```typescript
* const dataURL = canvas.toDataURL('image/jpeg');
* const picture = dataURLToPicture(dataURL, PictureType.FrontCover);
* const modifiedBuffer = await applyPictures("song.mp3", [picture]);
* ```
*/
export declare function dataURLToPicture(dataURL: string, type?: PictureType, description?: string): Picture;
//# sourceMappingURL=data-url.d.ts.map