UNPKG

@adonis-agora/media

Version:

Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a

20 lines • 1.1 kB
import type { TransformerContext } from '../transformer.js'; /** What {@link withSourceFile} hands its callback. */ export interface MaterializedSource { /** Local path of the original's bytes. */ sourcePath: string; /** The temp directory the source lives in — free scratch space, removed when the callback ends. */ tempDir: string; } /** * Materialize a media original into a local temp file for the duration of `fn`, then remove the * whole temp directory — success or failure. * * File-based media engines (mediabunny, and most others) want random access to a local path, while * a disk object only offers bytes/stream — so file-shaped transformers all start with this same * dance. The bytes are **streamed** to disk, never buffered whole: the typical subject is a video. * The file keeps the original's extension purely as a debugging nicety; engines detect the real * format from content. */ export declare function withSourceFile<T>(context: TransformerContext, fn: (source: MaterializedSource) => Promise<T>): Promise<T>; //# sourceMappingURL=source_file.d.ts.map