react-firehooks
Version:
Lightweight dependency-free collection of React hooks for Firebase
16 lines (15 loc) • 957 B
TypeScript
import { StorageError, StorageReference } from "firebase/storage";
import type { ValueHookResult } from "../common/index.js";
export type UseStreamResult = ValueHookResult<NodeJS.ReadableStream, StorageError>;
/**
* Returns the data of a Google Cloud Storage object as a stream
*
* This hook is only available in Node
* @param reference Reference to a Google Cloud Storage object
* @param maxDownloadSizeBytes If set, the maximum allowed size in bytes to retrieve
* @returns Data, loading state, and error
* - value: Object data as stream; `undefined` if data of the object is currently being downloaded, or an error occurred
* - loading: `true` while downloading the data of the object; `false` if the data was downloaded successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export declare function useStream(reference: StorageReference | undefined | null, maxDownloadSizeBytes?: number | undefined): UseStreamResult;