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