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      modificationTime: number;
33      md5?: string;
34    }
35  | {
36      exists: false;
37      isDirectory: false;
38    };
39
40export enum EncodingType {
41  UTF8 = 'utf8',
42  Base64 = 'base64',
43}
44
45export type ReadingOptions = {
46  encoding?: EncodingType | 'utf8' | 'base64';
47  position?: number;
48  length?: number;
49};
50
51export type WritingOptions = {
52  encoding?: EncodingType | 'utf8' | 'base64';
53};
54
55export type ProgressEvent = {
56  uuid: string;
57  data: {
58    totalBytesWritten: number;
59    totalBytesExpectedToWrite: number;
60  };
61};
62