import type { AudioProperties, FileType, Picture, PropertyMap } from "../types.js"; import type { TypedAudioProperties } from "../types/audio-formats.js"; import type { Rating } from "../constants/complex-properties.js"; import type { MutableTag } from "./mutable-tag.js"; import type { FormatPropertyKey } from "../types/format-property-keys.js"; /** * Represents an audio file with metadata and audio properties. * Provides methods for reading and writing metadata, accessing audio properties, * and managing format-specific features. */ export interface AudioFile { /** Get the audio file format. */ getFormat(): FileType; /** Get the tag object for reading/writing basic metadata. */ tag(): MutableTag; /** Get audio properties (duration, bitrate, sample rate, etc.). */ audioProperties(): AudioProperties | undefined; /** Get all metadata properties as a key-value map. */ properties(): PropertyMap; /** Set multiple properties at once from a PropertyMap. */ setProperties(properties: PropertyMap): void; /** Get a single property value by key (typed version). */ getProperty(key: K): import("../constants.js").PropertyValue | undefined; /** Get a single property value by key (string version). */ getProperty(key: string): string | undefined; /** Set a single property value (typed version). */ setProperty(key: K, value: import("../constants.js").PropertyValue): void; /** Set a single property value (string version). */ setProperty(key: string, value: string): void; /** Type-narrowing check: returns true if this file matches the given format. */ isFormat(format: F): this is TypedAudioFile; /** Check if this is an MP4/M4A file. */ isMP4(): boolean; /** Get an MP4-specific metadata item. */ getMP4Item(key: string): string | undefined; /** Set an MP4-specific metadata item. */ setMP4Item(key: string, value: string): void; /** Remove an MP4-specific metadata item. */ removeMP4Item(key: string): void; /** Save all changes to the in-memory buffer. */ save(): boolean; /** Get the current file data as a buffer, including any modifications. */ getFileBuffer(): Uint8Array; /** * Save all changes to a file on disk. * @param path - Optional file path. If not provided, saves to the original path. */ saveToFile(path?: string): Promise; /** Check if the file was loaded successfully and is valid. */ isValid(): boolean; /** Get all pictures/cover art from the audio file. */ getPictures(): Picture[]; /** Set pictures/cover art in the audio file (replaces all existing). */ setPictures(pictures: Picture[]): void; /** Add a single picture to the audio file. */ addPicture(picture: Picture): void; /** Remove all pictures from the audio file. */ removePictures(): void; /** Get all ratings (normalized 0.0-1.0) from the audio file. */ getRatings(): Rating[]; /** Set ratings in the audio file (replaces all existing). */ setRatings(ratings: Rating[]): void; /** Get the primary rating (first one found), or undefined. */ getRating(): number | undefined; /** Set the primary rating (normalized 0.0-1.0). */ setRating(rating: number, email?: string): void; /** Release all resources associated with this file. */ dispose(): void; /** Enable `using file = ...` for automatic cleanup. */ [Symbol.dispose](): void; } /** * An AudioFile narrowed to a specific format, constraining getProperty/setProperty * to only accept property keys valid for that format's tag system. * * Note: The string-accepting overloads are intentionally removed. If you need * arbitrary string keys (e.g. custom tags), use the un-narrowed AudioFile reference. */ export interface TypedAudioFile extends Omit { getFormat(): F; audioProperties(): TypedAudioProperties | undefined; getProperty>(key: K): import("../constants.js").PropertyValue | undefined; setProperty>(key: K, value: import("../constants.js").PropertyValue): void; } //# sourceMappingURL=audio-file-interface.d.ts.map