msb-file 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
File without changes
@@ -0,0 +1,70 @@
1
+ declare class Download {
2
+ static EVENTS: typeof EVENTS;
3
+ static STATUS: typeof STATUS;
4
+ url: string;
5
+ fileName: string;
6
+ isReady: boolean;
7
+ abortController?: AbortController;
8
+ currentChunk: number;
9
+ chunkSize: number;
10
+ totalChunk: number;
11
+ totalSize: number;
12
+ status: STATUS;
13
+ onReady: DownloadOptions['onReady'];
14
+ onStatusChange: DownloadOptions['onStatusChange'];
15
+ onProgressUpdate: DownloadOptions['onProgressUpdate'];
16
+ constructor({ url, fileName, chunkSize, onReady, onProgressUpdate, onStatusChange, }: DownloadOptions);
17
+ static setMitmPath(path: string): void;
18
+ changeStatus(value: STATUS, error?: any): void;
19
+ openDB(): Promise<void>;
20
+ getChunkKeys(): Promise<string[]>;
21
+ getCompletedCount(): Promise<number>;
22
+ getResumePosition(): Promise<number>;
23
+ init(): Promise<void>;
24
+ getURLMd5: () => string;
25
+ getFileSize(): Promise<number>;
26
+ getCurrentChunkName(currentChunk: number): string;
27
+ getChunkData(start: number, end: number): Promise<ArrayBuffer>;
28
+ abort(): void;
29
+ updateProgress(): Promise<void>;
30
+ resetState(): void;
31
+ start(): void;
32
+ pause(): void;
33
+ resume(): Promise<void>;
34
+ cancel(): Promise<void>;
35
+ uploadSingeChunk(currentChunk: number): Promise<void>;
36
+ download(): Promise<void>;
37
+ remove(): Promise<void>;
38
+ mergeAndDownload(): Promise<void>;
39
+ destroy(): void;
40
+ }
41
+ export default Download;
42
+
43
+ export declare type DownloadOptions = {
44
+ url: string;
45
+ fileName: string;
46
+ onReady?: () => void;
47
+ onStatusChange?: (data: {
48
+ status: STATUS;
49
+ error: any;
50
+ }) => void;
51
+ onProgressUpdate?: (value: string) => void;
52
+ onError?: (error: any) => void;
53
+ chunkSize?: number;
54
+ };
55
+
56
+ declare enum EVENTS {
57
+ READY = "ready",
58
+ STATUS_UPDATE = "status_update",
59
+ PROGRESS_UPDATE = "progress_update"
60
+ }
61
+
62
+ export declare enum STATUS {
63
+ PENDING = "pending",
64
+ PAUSE = "pause",
65
+ DOWNLOADING = "downloading",
66
+ FINISHED = "finished",
67
+ ERROR = "error"
68
+ }
69
+
70
+ export { }