augment.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. declare module 'uzip' {
  2. namespace UZIP {
  3. function deflateRaw(buf: Uint8Array, opts?: { level: number }): Uint8Array;
  4. function inflateRaw(buf: Uint8Array, out?: Uint8Array): Uint8Array;
  5. function deflate(buf: Uint8Array, opts?: { level: number }): Uint8Array;
  6. function inflate(buf: Uint8Array, out?: Uint8Array): Uint8Array;
  7. function encode(files: Record<string, Uint8Array>, noCmpr?: boolean): ArrayBuffer;
  8. function parse(buf: ArrayBuffer): Record<string, ArrayBuffer>;
  9. }
  10. export = UZIP;
  11. }
  12. interface DataTransferItem {
  13. webkitGetAsEntry(): FileSystemEntry;
  14. }
  15. interface BaseFileSystemEntry {
  16. fullPath: string;
  17. name: string;
  18. isFile: boolean;
  19. isDirectory: boolean;
  20. }
  21. interface FileSystemFileEntry extends BaseFileSystemEntry {
  22. isFile: true;
  23. isDirectory: false
  24. file(onSuccess: (file: File) => void, onError: (err: Error) => void): void;
  25. }
  26. type FileSystemEntry = FileSystemFileEntry | FileSystemDirectoryEntry;
  27. interface FileSystemDirectoryReader {
  28. readEntries(onSuccess: (entries: FileSystemEntry[]) => void, onError: (err: Error) => void): void;
  29. }
  30. interface FileSystemDirectoryEntry extends BaseFileSystemEntry {
  31. isFile: false;
  32. isDirectory: true;
  33. createReader(): FileSystemDirectoryReader;
  34. }
  35. interface File {
  36. webkitRelativePath: string;
  37. }