Skip to content

FiletypeHooks

FiletypeHooks<TInput> = object

Defined in: packages/storage/src/types.ts:81

Lifecycle hooks for a file type, invoked during the upload pipeline.

Use beforeUpload for pre-processing (e.g. quota checks, image resizing) and afterUpload for post-processing (e.g. saving to the database, triggering a queue).

TInput = Record<string, unknown>

The shape of caller-provided input available in the hook context.

optional afterUpload: (result, ctx) => Promise<void>

Defined in: packages/storage/src/types.ts:85

Called after a successful upload completes.

UploadResult

HandleContext<TInput>

Promise<void>


optional beforeUpload: (file, ctx) => Promise<void>

Defined in: packages/storage/src/types.ts:83

Called after validation but before bytes are written to R2.

FileInfo

HandleContext<TInput>

Promise<void>