StorageFile
A wrapper class for convenient handling of file hash identifiers uploaded to the media storage.
Instances of the StorageFile class represent runtime values of fields in heap tables declared through Heap.File.
It can also be used for easy handling of uploaded media files outside the context of the heap.
Usage/Signature
import { StorageFile } from '@app/storage'
const file = new StorageFile(hash)
Properties and Methods
-
downloadUrl:
string
An absolute URL for downloading the file. -
hash:
string
The file identifier in a special format that contains the file type, a unique hash, the extension, and additional information about the file depending on the extension (e.g., image dimensions). -
type:
'image' | 'video' | 'audio' | 'file'
The file type, supported and determined from thehash
property. If the file hash is recognized as an image, video, or audio recording, then such a file is represented by an instance of a subclass with additional methods corresponding to the file type.- image — an image file. Represented by the subclass StorageImageFile.
- video — a video file. Represented by the subclass StorageVideoFile.
- audio — an audio file. Represented by the subclass StorageAudioFile.
- file — any file type other than those listed above.