/
FileSystem.types.d.ts
90 lines (90 loc) · 2.59 KB
/
FileSystem.types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
export declare type DownloadOptions = {
md5?: boolean;
cache?: boolean;
headers?: {
[name: string]: string;
};
};
export declare type DownloadResult = {
uri: string;
status: number;
headers: {
[name: string]: string;
};
md5?: string;
};
export declare type DownloadProgressCallback = (data: DownloadProgressData) => void;
export declare type DownloadProgressData = {
totalBytesWritten: number;
totalBytesExpectedToWrite: number;
};
export declare type DownloadPauseState = {
url: string;
fileUri: string;
options: DownloadOptions;
resumeData?: string;
};
export declare type FileInfo = {
exists: true;
uri: string;
size: number;
isDirectory: boolean;
modificationTime: number;
md5?: string;
} | {
exists: false;
uri: string;
size: undefined;
isDirectory: false;
modificationTime: undefined;
md5: undefined;
};
export declare enum EncodingType {
UTF8 = "utf8",
Base64 = "base64"
}
export declare type ReadingOptions = {
encoding?: EncodingType | 'utf8' | 'base64';
position?: number;
length?: number;
};
export declare type WritingOptions = {
encoding?: EncodingType | 'utf8' | 'base64';
};
export declare type ProgressEvent = {
uuid: string;
data: {
totalBytesWritten: number;
totalBytesExpectedToWrite: number;
};
};
export declare type FileSystemContentUri = {
uri: string;
};
declare type PlatformMethod = (...args: any[]) => Promise<any>;
export interface ExponentFileSystemModule {
readonly name: 'ExponentFileSystem';
readonly documentDirectory: string | null;
readonly cacheDirectory: string | null;
readonly bundledAssets: string | null;
readonly bundleDirectory: string | null;
readonly getInfoAsync?: PlatformMethod;
readonly readAsStringAsync?: PlatformMethod;
readonly writeAsStringAsync?: PlatformMethod;
readonly deleteAsync?: PlatformMethod;
readonly moveAsync?: PlatformMethod;
readonly copyAsync?: PlatformMethod;
readonly makeDirectoryAsync?: PlatformMethod;
readonly readDirectoryAsync?: PlatformMethod;
readonly downloadAsync?: PlatformMethod;
readonly downloadResumableStartAsync?: PlatformMethod;
readonly downloadResumablePauseAsync?: PlatformMethod;
readonly getContentUriAsync?: PlatformMethod;
readonly getFreeDiskStorageAsync?: PlatformMethod;
readonly getTotalDiskCapacityAsync?: PlatformMethod;
startObserving?: () => void;
stopObserving?: () => void;
addListener: (eventName: string) => void;
removeListeners: (count: number) => void;
}
export {};