Media / foldkit-media/server

filesKeyValueStore

function · packages/media/src/server/fileStore.ts:80

function filesKeyValueStore(
  options?: FileStoreOptions,
): Layer.Layer<
  FileStore,
  never,
  KeyValueStore.KeyValueStore | SecureRandom.SecureRandom
>

Files in the application's KeyValueStore, each key minted from SecureRandom. Bytes are never shared between uploads, even equal ones, so an upload's speed says nothing of what others hold. A store that fails is a defect: the file is data.

A key-value store cannot compare and set, so two claims racing by the same owner may both succeed; a claim by anyone else cannot.