taglib-wasm
Version:
TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps
59 lines • 1.92 kB
TypeScript
import type { Picture } from "../types.js";
/**
* Display a Picture in an HTML img element
*
* @param picture - Picture object from TagLib-Wasm
* @param imgElement - HTMLImageElement to display the picture in
*
* @example
* ```typescript
* const pictures = await readPictures("song.mp3");
* const img = document.getElementById('coverArt') as HTMLImageElement;
* displayPicture(pictures[0], img);
* ```
*/
export declare function displayPicture(picture: Picture, imgElement: HTMLImageElement): void;
/**
* Create a download link for a Picture
*
* @param picture - Picture object to download
* @param filename - Suggested filename for download
* @returns Temporary download URL (remember to revoke it after use)
*
* @example
* ```typescript
* const pictures = await readPictures("song.mp3");
* const downloadUrl = createPictureDownloadURL(pictures[0], "cover.jpg");
*
* const link = document.createElement('a');
* link.href = downloadUrl;
* link.download = "cover.jpg";
* link.click();
*
* // Clean up
* URL.revokeObjectURL(downloadUrl);
* ```
*/
export declare function createPictureDownloadURL(picture: Picture, filename?: string): string;
/**
* Extract all pictures and create a gallery
*
* @param file - Audio file to extract pictures from
* @param container - HTML element to append gallery items to
* @param options - Gallery display options
*
* @example
* ```typescript
* const galleryDiv = document.getElementById('pictureGallery');
* await createPictureGallery("song.mp3", galleryDiv, {
* className: 'album-art',
* includeDescription: true
* });
* ```
*/
export declare function createPictureGallery(file: string | Uint8Array | ArrayBuffer | File, container: HTMLElement, options?: {
className?: string;
includeDescription?: boolean;
onClick?: (picture: Picture, index: number) => void;
}): Promise<void>;
//# sourceMappingURL=dom-integration.d.ts.map