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).
Type Parameters
Section titled “Type Parameters”TInput
Section titled “TInput”TInput = Record<string, unknown>
The shape of caller-provided input available in the hook context.
Properties
Section titled “Properties”afterUpload()?
Section titled “afterUpload()?”
optionalafterUpload: (result,ctx) =>Promise<void>
Defined in: packages/storage/src/types.ts:85
Called after a successful upload completes.
Parameters
Section titled “Parameters”result
Section titled “result”HandleContext<TInput>
Returns
Section titled “Returns”Promise<void>
beforeUpload()?
Section titled “beforeUpload()?”
optionalbeforeUpload: (file,ctx) =>Promise<void>
Defined in: packages/storage/src/types.ts:83
Called after validation but before bytes are written to R2.
Parameters
Section titled “Parameters”HandleContext<TInput>
Returns
Section titled “Returns”Promise<void>