Media / foldkit-media/server
fileHandlers
function · packages/media/src/server/files.ts:189
function fileHandlers(
options: FileOptions,
): Layer.Layer<
HttpApiGroup.Service<'foldkit-media-files', 'files'>,
never,
FileStore | FileUploadPolicy | FileReadPolicy
>The file routes' handlers. An upload is asked of the FileUploadPolicy
first, then must be application/octet-stream (which no page on another
site can send without a preflight this route never answers), declare a
name and an accepted type in its headers, pass Admission when one is
given, find a free slot, arrive within maxBytes and the minimum rate, and
pass inspect; it answers the kept FileAsset, 201. A download checks
the key's grammar, then the FileReadPolicy, then the store, and answers
the bytes as an attachment that cannot run on this origin.