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

48 lines • 1.65 kB
import { type Readable } from 'node:stream'; import type { MediaRecord } from '../media_record.js'; import { type MediaAccountConsoleOptions } from './extension.js'; /** What the upload endpoint needs from the request. */ export interface AccountUploadRequest { header(name: string): string | undefined | null; body: Readable; } /** What it answers. */ export interface AccountUploadResponse { status: number; body: { id: string; } | { error: string; }; } /** What it stores through. */ export interface AccountUploadMedia { readonly tenancy: { enabled: boolean; }; readonly library: { attach(input: { ownerType: string; ownerId: string; collection: string; fileName: string; mimeType: string; contents: Readable; size?: number; tenantId?: string | null; }): Promise<MediaRecord>; }; } /** * `POST <accountConsole.path>/uploads`: stores one file for the account console's upload * component. The request carries the ticket the page issued (owner, collection, tenant, expiry, * HMAC-signed) in `x-media-upload-ticket`, the file name in `x-file-name` and the bytes as the body. * Everything a collection enforces on attach (MIME whitelist, content check) still applies. */ export declare function handleAccountUpload(request: AccountUploadRequest, deps: { media: () => Promise<AccountUploadMedia>; options: MediaAccountConsoleOptions; secret: string; now?: () => number; }): Promise<AccountUploadResponse>; //# sourceMappingURL=upload_endpoint.d.ts.map