1export type DownloadOptions = { 2 md5?: boolean; 3 cache?: boolean; 4 headers?: { [name: string]: string }; 5}; 6 7export type DownloadResult = { 8 uri: string; 9 status: number; 10 headers: { [name: string]: string }; 11 md5?: string; 12}; 13 14export type DownloadProgressCallback = (data: DownloadProgressData) => void; 15 16export type DownloadProgressData = { 17 totalBytesWritten: number; 18 totalBytesExpectedToWrite: number; 19}; 20 21export type DownloadPauseState = { 22 url: string; 23 fileUri: string; 24 options: DownloadOptions; 25 resumeData?: string; 26}; 27 28export 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 46export enum EncodingType { 47 UTF8 = 'utf8', 48 Base64 = 'base64', 49} 50 51export type ReadingOptions = { 52 encoding?: EncodingType | 'utf8' | 'base64'; 53 position?: number; 54 length?: number; 55}; 56 57export type WritingOptions = { 58 encoding?: EncodingType | 'utf8' | 'base64'; 59}; 60 61export type ProgressEvent = { 62 uuid: string; 63 data: { 64 totalBytesWritten: number; 65 totalBytesExpectedToWrite: number; 66 }; 67}; 68 69type PlatformMethod = (...args: any[]) => Promise<any>; 70 71export 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 90 startObserving?: () => void; 91 stopObserving?: () => void; 92 addListener: (eventName: string) => void; 93 removeListeners: (count: number) => void; 94} 95