Heap.File
Declares a field for convenient storage and manipulation of the file identifier uploaded to the file storage.
This is a non-standard type in the JSON schema. It is stored in the database as a string identifier of the file in the storage, obtained when uploading the file using the attachMedia action, and at runtime, it is represented by an instance of a special class StorageFile.
You can read more about working with files in the relevant section of the guide.
Usage / Signature
import { Heap } from '@app/heap'
Heap.File()
Return Value
JSON schema for a string field.
Examples
List of files attached to an incident
const issues = Heap.Table('issues', {
attaches: Heap.NonRequired(
Heap.Array(Heap.Object({
file: Heap.File(),
name: Heap.String(),
})),
[],
),
})
issue.attaches.map(attach =>
<list-item
content={{ title: attach.name }}
onClick={attach.file.downloadUrl}
/>
)