import { ... } from 'react-firehooks/storage';
Returns the data of a Google Cloud Storage object as a Blob
This hook is not available in Node.
const [data, loading, error] = useBlob(storageReference);
Params:
reference
: Reference to a Google Cloud Storage objectmaxDownloadSizeBytes
: If set, the maximum allowed size in bytes to retrieve.
Returns:
value
: Object data as a Blob;undefined
if data of the object is currently being downloaded, or an error occurredloading
:true
while downloading the data of the object;false
if the data was downloaded successfully or an error occurrederror
:undefined
if no error occurred
Returns the data of a Google Cloud Storage object
const [data, loading, error] = useBytes(storageReference);
Params:
reference
: Reference to a Google Cloud Storage objectmaxDownloadSizeBytes
: If set, the maximum allowed size in bytes to retrieve.
Returns:
value
: Object data;undefined
if data of the object is currently being downloaded, or an error occurredloading
:true
while downloading the data of the object;false
if the data was downloaded successfully or an error occurrederror
:undefined
if no error occurred
Returns the download URL of a Google Cloud Storage object
const [url, loading, error] = useDownloadURL(storageReference);
Params:
reference
: Reference to a Google Cloud Storage object
Returns:
value
: Download URL;undefined
if download URL is currently being fetched, or an error occurredloading
:true
while fetching the download URL;false
if the download URL was fetched successfully or an error occurrederror
:undefined
if no error occurred
Returns the metadata of a Google Cloud Storage object
const [metadata, loading, error] = useMetadata(storageReference);
Params:
reference
: Reference to a Google Cloud Storage object
Returns:
value
: Metadata;undefined
if metadata is currently being fetched, or an error occurredloading
:true
while fetching the metadata;false
if the metadata was fetched successfully or an error occurrederror
:undefined
if no error occurred
Returns the data of a Google Cloud Storage object as a stream
This hook is only available in Node.
const [data, loading, error] = useStream(storageReference);
Params:
reference
: Reference to a Google Cloud Storage objectmaxDownloadSizeBytes
: If set, the maximum allowed size in bytes to retrieve.
Returns:
value
: Object data as a stream;undefined
if data of the object is currently being downloaded, or an error occurredloading
:true
while downloading the data of the object;false
if the data was downloaded successfully or an error occurrederror
:undefined
if no error occurred