1export type DownloadOptions = {
2  md5?: boolean;
3  headers?: { [name: string]: string };
4};
5
6export type DownloadResult = {
7  uri: string;
8  status: number;
9  headers: { [name: string]: string };
10  md5?: string;
11};
12
13export type DownloadProgressCallback = (data: DownloadProgressData) => void;
14
15export type DownloadProgressData = {
16  totalBytesWritten: number;
17  totalBytesExpectedToWrite: number;
18};
19
20export type DownloadPauseState = {
21  url: string;
22  fileUri: string;
23  options: DownloadOptions;
24  resumeData?: string;
25};
26
27export type FileInfo =
28  | {
29      exists: true;
30      uri: string;
31      size: number;
32      isDirectory: boolean;
33      modificationTime: number;
34      md5?: string;
35    }
36  | {
37      exists: false;
38      uri: string;
39      size: undefined;
40      isDirectory: false;
41      modificationTime: undefined;
42      md5: undefined;
43    };
44
45export enum EncodingType {
46  UTF8 = 'utf8',
47  Base64 = 'base64',
48}
49
50export type ReadingOptions = {
51  encoding?: EncodingType | 'utf8' | 'base64';
52  position?: number;
53  length?: number;
54};
55
56export type WritingOptions = {
57  encoding?: EncodingType | 'utf8' | 'base64';
58};
59
60export type ProgressEvent = {
61  uuid: string;
62  data: {
63    totalBytesWritten: number;
64    totalBytesExpectedToWrite: number;
65  };
66};
67