@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
27 lines • 1.48 kB
TypeScript
/** Requested upload strategy. `auto` picks `direct` when the disk is multipart-capable, else `proxy`. */
export type UploadMode = 'auto' | 'proxy' | 'direct';
/** The concrete strategy after resolution — `auto` has been collapsed to one of these. */
export type ResolvedUploadMode = 'proxy' | 'direct';
/**
* The upload mode configured at each level. The most specific wins:
* per-call → per-disk → global → `auto`.
*/
export interface UploadModeLevels {
/** Global default from `config/media.ts` (`uploads.mode`). */
global?: UploadMode | undefined;
/** A per-disk override (unused by the bundled disks; reserved for future per-disk config). */
perDisk?: UploadMode | undefined;
/** A per-call override passed to the upload method. */
perCall?: UploadMode | undefined;
}
/**
* Decide whether an upload flows through the backend (`proxy` — the app streams bytes to the disk)
* or straight to the disk (`direct` — the app issues presigned multipart part URLs and the client
* uploads to S3 itself).
*
* - `proxy`: always allowed (every disk can accept bytes through `put`/`putStream`).
* - `direct`: requires a multipart-capable disk; otherwise throws {@link UploadNotSupportedError}.
* - `auto`: `direct` when the disk is multipart-capable, else `proxy`.
*/
export declare function resolveUploadMode(levels: UploadModeLevels, directCapable: boolean, diskName?: string): ResolvedUploadMode;
//# sourceMappingURL=upload_mode.d.ts.map