-
-
Notifications
You must be signed in to change notification settings - Fork 54
FB4D Reference IStorageObject
The IStorageObject returns all information about the stored file. Additionally, it allows downloading the file to a stream by the following synchronous method:
procedure DownloadToStreamSynchronous(Stream: TStream);
To download the file asynchronously from the main thread, use the following method:
procedure DownloadToStream(Stream: TStream; OnSuccess: TOnDownload; OnError: TOnDownloadError);
type
TOnDownload = procedure(Obj: IStorageObject) of object;
TOnDownloadError = procedure(Obj: IStorageObject; const ErrorMsg: string) of object;
TOnStorageError = procedure(const ObjectName: TObjectName; const ErrMsg: string) of object;
There is a second overloaded method with a different call back method for error situations, where only the object name is returned instead of the storage object:
procedure DownloadToStream(Stream: TStream; OnSuccess: TOnDownload; OnError: TOnStorageError); overload;
type
TOnStorageError = procedure(const ObjectName: TObjectName; const ErrMsg: string) of object;
Until version 1.2 the ObjectName
was added as the first parameter. This method is marked now as deprecated and will be removed with version 1.3.
The function ObjectName returns either the file name only or the full file name including the path from the Storage.
function ObjectName(IncludePath: boolean = true): string;
The next function returns only the path where the file is stored:
function Path: string;
The next function returns the parent folder name:
function LastPathElement: string;
The next function returns the file type:
function ContentType: string;
The next function returns the file size in bytes:
function Size: Int64;
The next function returns the bucket name of the file:
function Bucket: string;
The next function returns the creation date and time in UTC or local time:
function createTime(TimeZone: TTimeZone = tzLocalTime): TDateTime;
The next function returns the date and time of the last update in UTC or local time:
function updateTime(TimeZone: TTimeZone = tzLocalTime): TDatetime;
By default, the Storage provides a download URL for each object. To download the file later the DownloadUrl
contains this Url.
function DownloadUrl: string;
The generated crypto token for the download URL is accessible also by the next function:
function DownloadToken: string;
For a quick comparison of a locally stored file with the file in the Storage, you can use the MD5 hash code.
function MD5HashCode: string;
The next function returns the storage class name. For more information see the Firebase documentation about storage classes.
function storageClass: string;
The next function returns the Etag. For more information see the Firebase documentation about hashes and etags in the storage
function etag: string;
The next two functions return the metadata for generation number. For more information see the Firebase documentation about Generation numbers and preconditions in the storage
function generation: Int64;
function metaGeneration: Int64;
If the cache function is used, the following method returns the local file name for storing the storage object within the cache folders. To avoid mapping the paths in the storage to the local directory, the cache file name is formed from the hash code of the entire storage path. As a side effect, the content of the storage cache is also obfuscated and the user does not see the file names from the storage in plain text. However, the file content is not obfuscated.
function CacheFileName: string;
Hint: Custom metadata is currently not supported by FB4D.
Have you discovered an error? Or is something unclear? Please let us know in the discussion forum.
Schneider Infosystems Ltd. CH-6340 Baar, Switzerland, www.schneider-infosys.ch
Introduction into FB4D
Getting Started
Fundamental Principles
Project Settings
GUI Pattern Self-Registration
RT-DB Sample Applications
Firestore Chat Sample Applications
PhotoBox demonstrates Firestore, Storage, VisionML
Interface Reference
Configuration and Class Factory
Helper Classes
Authentication