UNPKG

taglib-wasm

Version:

TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps

60 lines 2.07 kB
import type { Picture, PictureType } from "../types.js"; /** * Export cover art from an audio file to an image file * * Extracts the primary cover art (front cover if available, otherwise first picture) * and saves it to the specified path. * * @param audioPath - Path to the audio file * @param imagePath - Path where the image should be saved * @returns Promise that resolves when the image is saved * @throws Error if no cover art is found * * @example * ```typescript * // Export cover art as JPEG * await exportCoverArt("album/track01.mp3", "album/cover.jpg"); * ``` */ export declare function exportCoverArt(audioPath: string, imagePath: string): Promise<void>; /** * Export a specific picture type from an audio file * * @param audioPath - Path to the audio file * @param imagePath - Path where the image should be saved * @param type - Picture type to export * @returns Promise that resolves when the image is saved * @throws Error if no picture of the specified type is found * * @example * ```typescript * // Export back cover * await exportPictureByType( * "album/track01.mp3", * "album/back-cover.jpg", * PictureType.BackCover * ); * ``` */ export declare function exportPictureByType(audioPath: string, imagePath: string, type: PictureType): Promise<void>; /** * Export all pictures from an audio file * * Saves each picture with a numbered suffix based on its type and index. * * @param audioPath - Path to the audio file * @param outputDir - Directory where images should be saved * @param options - Export options * @returns Promise resolving to array of created file paths * * @example * ```typescript * // Export all pictures to a directory * const files = await exportAllPictures("song.mp3", "./artwork/"); * console.log(`Exported ${files.length} pictures`); * ``` */ export declare function exportAllPictures(audioPath: string, outputDir: string, options?: { nameFormat?: (picture: Picture, index: number) => string; }): Promise<string[]>; //# sourceMappingURL=export-operations.d.ts.map