UNPKG

react-native-cloud-storage

Version:

☁️ Save to & read from iCloud and Google Drive using React Native

39 lines 1.49 kB
import type { CloudStorageScope } from '../types/main'; import RNCloudStorage from '../cloud-storage'; /** * A utility hook for reading and writing to a single file in the cloud. * @param path The path to the file. * @param scope The directory scope the path is in. Defaults to the default scope set for the current provider. * @param cloudStorageInstance An optional instance of RNCloudStorage to use instead of the default instance. * @returns An object containing the file's contents and functions for downloading, reading, writing, and removing the file. */ export declare const useCloudFile: (path: string, scope?: CloudStorageScope, cloudStorageInstance?: RNCloudStorage) => { /** * The content of the file. */ content: string | null; /** * Reads the file from the cloud. */ read: () => Promise<void>; /** * Writes new content to the file. */ write: (newContent: string) => Promise<void>; /** * Deletes the file. */ remove: () => Promise<void>; /** * Triggers synchronization for the file. Needed if the file hasn't been synced yet from iCloud. * Has no effect on Google Drive. */ sync: () => Promise<void>; /** * Triggers synchronization for the file. Needed if the file hasn't been synced yet from iCloud. * Has no effect on Google Drive. * @deprecated Use `sync` instead. */ download: () => Promise<void>; }; //# sourceMappingURL=use-cloud-file.d.ts.map