filereader.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /// <reference types="node" />
  2. import { Blob } from 'buffer'
  3. import { DOMException, Event, EventInit, EventTarget } from './patch'
  4. export declare class FileReader {
  5. __proto__: EventTarget & FileReader
  6. constructor ()
  7. readAsArrayBuffer (blob: Blob): void
  8. readAsBinaryString (blob: Blob): void
  9. readAsText (blob: Blob, encoding?: string): void
  10. readAsDataURL (blob: Blob): void
  11. abort (): void
  12. static readonly EMPTY = 0
  13. static readonly LOADING = 1
  14. static readonly DONE = 2
  15. readonly EMPTY = 0
  16. readonly LOADING = 1
  17. readonly DONE = 2
  18. readonly readyState: number
  19. readonly result: string | ArrayBuffer | null
  20. readonly error: DOMException | null
  21. onloadstart: null | ((this: FileReader, event: ProgressEvent) => void)
  22. onprogress: null | ((this: FileReader, event: ProgressEvent) => void)
  23. onload: null | ((this: FileReader, event: ProgressEvent) => void)
  24. onabort: null | ((this: FileReader, event: ProgressEvent) => void)
  25. onerror: null | ((this: FileReader, event: ProgressEvent) => void)
  26. onloadend: null | ((this: FileReader, event: ProgressEvent) => void)
  27. }
  28. export interface ProgressEventInit extends EventInit {
  29. lengthComputable?: boolean
  30. loaded?: number
  31. total?: number
  32. }
  33. export declare class ProgressEvent {
  34. __proto__: Event & ProgressEvent
  35. constructor (type: string, eventInitDict?: ProgressEventInit)
  36. readonly lengthComputable: boolean
  37. readonly loaded: number
  38. readonly total: number
  39. }