Skip to content

ui/build/data-renderer/file/file.types

ui/build/data-renderer/file/file.types

Functions

fileRefFromFileValue()

function fileRefFromFileValue(file): object;

Defined in: apps/website/.api-docs-entry/ui/build/data-renderer/file/file.types.d.ts:28

Persists the object-store key an upload returned, not its UI upload id.

Existing hydrated values use the storage key as id; a fresh upload deliberately has two identities because its stored key also carries the file extension. FileInput speaks the shared display shape, so the upload-only member is read structurally at this boundary.

Parameters

Parameter Type
file FileValue

Returns

object

file_name
readonly file_name: string;
file_size
readonly file_size: number;
mime_type
readonly mime_type: string;
storage_key
readonly storage_key: string;

fileValueFromFileRef()

function fileValueFromFileRef(ref, urlFor): FileValue;

Defined in: apps/website/.api-docs-entry/ui/build/data-renderer/file/file.types.d.ts:20

Hydrates a stored reference without assuming anything about the host's public file route.

Parameters

Parameter Type
ref { file_name: string; file_size: number; mime_type: string; storage_key: string; }
ref.file_name string
ref.file_size number
ref.mime_type string
ref.storage_key string
urlFor (storageKey) => string

Returns

FileValue


readFileRef()

function readFileRef(candidate):
  | {
  file_name: string;
  file_size: number;
  mime_type: string;
  storage_key: string;
}
  | null;

Defined in: apps/website/.api-docs-entry/ui/build/data-renderer/file/file.types.d.ts:18

The tolerant read of a stored file-column value: older uploads predate the column carrying its own display facts, so missing ones fall back to the only stable identity a file has.

Parameters

Parameter Type
candidate unknown

Returns

| { file_name: string; file_size: number; mime_type: string; storage_key: string; } | null