taglib-wasm
Version:
TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps
86 lines • 2.79 kB
TypeScript
import type { Picture, PictureType } from "../types.js";
/**
* Import cover art from an image file to an audio file
*
* Replaces all existing pictures with a single front cover from the image file.
* The audio file is modified in place.
*
* @param audioPath - Path to the audio file to update
* @param imagePath - Path to the image file to import
* @param options - Import options
* @returns Promise that resolves when the audio file is updated
*
* @example
* ```typescript
* // Replace cover art with a new image
* await importCoverArt("song.mp3", "new-cover.jpg");
* ```
*/
export declare function importCoverArt(audioPath: string, imagePath: string, options?: {
mimeType?: string;
description?: string;
}): Promise<void>;
/**
* Import a picture from file with specific type
*
* Adds or replaces a picture of the specified type in the audio file.
* The audio file is modified in place.
*
* @param audioPath - Path to the audio file to update
* @param imagePath - Path to the image file to import
* @param type - Picture type to set
* @param options - Import options
* @returns Promise that resolves when the audio file is updated
*
* @example
* ```typescript
* // Add a back cover
* await importPictureWithType(
* "song.mp3",
* "back-cover.jpg",
* PictureType.BackCover,
* { description: "Album back cover" }
* );
* ```
*/
export declare function importPictureWithType(audioPath: string, imagePath: string, type: PictureType, options?: {
mimeType?: string;
description?: string;
}): Promise<void>;
/**
* Load a picture from an image file
*
* @param imagePath - Path to the image file
* @param type - Picture type (defaults to FrontCover)
* @param options - Picture options
* @returns Picture object ready to be applied to audio files
*
* @example
* ```typescript
* const frontCover = await loadPictureFromFile("cover.jpg");
* const backCover = await loadPictureFromFile("back.png", PictureType.BackCover);
*
* const modifiedBuffer = await applyPictures("song.mp3", [frontCover, backCover]);
* ```
*/
export declare function loadPictureFromFile(imagePath: string, type?: PictureType, options?: {
mimeType?: string;
description?: string;
}): Promise<Picture>;
/**
* Save a picture to an image file
*
* @param picture - Picture object to save
* @param imagePath - Path where the image should be saved
* @returns Promise that resolves when the image is saved
*
* @example
* ```typescript
* const pictures = await readPictures("song.mp3");
* for (const picture of pictures) {
* await savePictureToFile(picture, `export-${picture.type}.jpg`);
* }
* ```
*/
export declare function savePictureToFile(picture: Picture, imagePath: string): Promise<void>;
//# sourceMappingURL=import-operations.d.ts.map