UNPKG

1.68 kBTypeScriptView Raw
1import { Subscription } from 'rxjs';
2export interface UploaderOptions {
3 concurrency: number;
4 allowedContentTypes?: string[];
5 maxUploads?: number;
6 maxFileSize?: number;
7}
8export interface BlobFile extends Blob {
9 name: string;
10}
11export declare enum UploadStatus {
12 Queue = 0,
13 Uploading = 1,
14 Done = 2,
15 Cancelled = 3
16}
17export interface UploadProgress {
18 status: UploadStatus;
19 data?: {
20 percentage: number;
21 speed: number;
22 speedHuman: string;
23 startTime: number | null;
24 endTime: number | null;
25 eta: number | null;
26 etaHuman: string | null;
27 };
28}
29export interface UploadFile {
30 id: string;
31 fileIndex: number;
32 lastModifiedDate: Date;
33 name: string;
34 size: number;
35 type: string;
36 form: FormData;
37 progress: UploadProgress;
38 response?: any;
39 responseStatus?: number;
40 sub?: Subscription | any;
41 nativeFile?: File;
42 responseHeaders?: {
43 [key: string]: string;
44 };
45}
46export interface UploadOutput {
47 type: 'addedToQueue' | 'allAddedToQueue' | 'uploading' | 'done' | 'start' | 'cancelled' | 'dragOver' | 'dragOut' | 'drop' | 'removed' | 'removedAll' | 'rejected';
48 file?: UploadFile;
49 nativeFile?: File;
50}
51export interface UploadInput {
52 type: 'uploadAll' | 'uploadFile' | 'cancel' | 'cancelAll' | 'remove' | 'removeAll';
53 url?: string;
54 method?: string;
55 id?: string;
56 fieldName?: string;
57 fileIndex?: number;
58 file?: UploadFile;
59 data?: {
60 [key: string]: string | Blob;
61 };
62 headers?: {
63 [key: string]: string;
64 };
65 includeWebKitFormBoundary?: boolean;
66 withCredentials?: boolean;
67}