summaryrefslogtreecommitdiff
path: root/demo/augment.d.ts
blob: 7f517eab5d05422fa7a49fbb8452c949cd02f077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
declare module 'uzip' {
  namespace UZIP {
    function deflateRaw(buf: Uint8Array, opts?: { level: number }): Uint8Array;
    function inflateRaw(buf: Uint8Array, out?: Uint8Array): Uint8Array;
    function deflate(buf: Uint8Array, opts?: { level: number }): Uint8Array;
    function inflate(buf: Uint8Array, out?: Uint8Array): Uint8Array;
    function encode(files: Record<string, Uint8Array>, noCmpr?: boolean): ArrayBuffer;
    function parse(buf: ArrayBuffer): Record<string, ArrayBuffer>;
  }
  export = UZIP;
}

interface DataTransferItem {
  webkitGetAsEntry(): FileSystemEntry;
}

interface BaseFileSystemEntry {
  fullPath: string;
  name: string;
  isFile: boolean;
  isDirectory: boolean;
}

interface FileSystemFileEntry extends BaseFileSystemEntry {
  isFile: true;
  isDirectory: false
  file(onSuccess: (file: File) => void, onError: (err: Error) => void): void;
}

type FileSystemEntry = FileSystemFileEntry | FileSystemDirectoryEntry;


interface FileSystemDirectoryReader {
  readEntries(onSuccess: (entries: FileSystemEntry[]) => void, onError: (err: Error) => void): void;
}

interface FileSystemDirectoryEntry extends BaseFileSystemEntry {
  isFile: false;
  isDirectory: true;
  createReader(): FileSystemDirectoryReader;
}

interface File {
  webkitRelativePath: string;
}