react-native-cloud-store
Version:
A react-native module for cloud operation
78 lines (77 loc) • 3.3 kB
TypeScript
export declare const defaultICloudContainerPath: string | undefined;
export declare function getDefaultICloudContainerPath(): Promise<string | undefined>;
export declare function getICloudURL(containerIdentifier?: string): Promise<string>;
export declare function isICloudAvailable(): Promise<boolean>;
export declare function writeFile(path: string, content: string, options?: {
override?: boolean;
onProgress?: (data: {
progress: number;
}) => void;
}): Promise<void>;
export declare function readFile(path: string): Promise<string>;
export declare function readDir(path: string): Promise<string[]>;
export declare function createDir(path: string): Promise<void>;
export declare function moveDir(pathFrom: string, pathTo: string): Promise<void>;
export declare function copy(pathFrom: string, pathTo: string, options?: {
override?: boolean;
}): Promise<void>;
export declare function unlink(path: string): Promise<void>;
export declare function exist(path: string): Promise<boolean>;
export interface ICloudStat {
isInICloud?: boolean;
containerDisplayName?: string;
isDownloading?: boolean;
hasCalledDownload?: boolean;
downloadStatus?: 'NSURLUbiquitousItemDownloadingStatusNotDownloaded' | 'NSURLUbiquitousItemDownloadingStatusCurrent' | 'NSURLUbiquitousItemDownloadingStatusDownloaded';
downloadError?: string;
isUploaded?: boolean;
isUploading?: boolean;
uploadError?: string;
hasUnresolvedConflicts?: boolean;
modifyTimestamp?: number;
createTimestamp?: number;
name?: string;
localizedName?: string;
fileSize?: number;
isDirectory?: boolean;
}
export declare function stat(path: string): Promise<ICloudStat>;
export declare function upload(localPath: string, path: string, options?: {
onProgress: (data: {
progress: number;
}) => void;
}): Promise<void>;
export declare function download(path: string, options?: {
onProgress: (data: {
progress: number;
}) => void;
}): Promise<void>;
export declare function registerGlobalUploadEvent(): {
remove(): void;
} | undefined;
export declare function registerGlobalDownloadEvent(): {
remove(): void;
} | undefined;
export declare function onICloudIdentityDidChange(fn: (data: {
tokenChanged: boolean;
}) => void): import("react-native").EmitterSubscription;
export declare type DocumentsGatheringData = {
id: string;
info: {
added: string[];
changed: string[];
removed: string[];
};
detail: Array<{
type: 'upload' | 'download';
path: string;
progress: number | null;
isDir: boolean | null;
}>;
};
declare type DocumentsGatheringEventHandler = (data: DocumentsGatheringData) => void;
export declare function onICloudDocumentsStartGathering(fn: DocumentsGatheringEventHandler): import("react-native").EmitterSubscription;
export declare function onICloudDocumentsGathering(fn: DocumentsGatheringEventHandler): import("react-native").EmitterSubscription;
export declare function onICloudDocumentsFinishGathering(fn: DocumentsGatheringEventHandler): import("react-native").EmitterSubscription;
export declare function onICloudDocumentsUpdateGathering(fn: DocumentsGatheringEventHandler): import("react-native").EmitterSubscription;
export {};