FileReader.idl 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #import <DOM/EventTarget.idl>
  2. #import <FileAPI/Blob.idl>
  3. #import <WebIDL/DOMException.idl>
  4. // https://w3c.github.io/FileAPI/#dfn-filereader
  5. [Exposed=(Window,Worker)]
  6. interface FileReader : EventTarget {
  7. constructor();
  8. // async read methods
  9. undefined readAsArrayBuffer(Blob blob);
  10. undefined readAsBinaryString(Blob blob);
  11. undefined readAsText(Blob blob, optional DOMString encoding);
  12. undefined readAsDataURL(Blob blob);
  13. undefined abort();
  14. // states
  15. const unsigned short EMPTY = 0;
  16. const unsigned short LOADING = 1;
  17. const unsigned short DONE = 2;
  18. readonly attribute unsigned short readyState;
  19. // File or Blob data
  20. readonly attribute (DOMString or ArrayBuffer)? result;
  21. readonly attribute DOMException? error;
  22. // event handler content attributes
  23. attribute EventHandler onloadstart;
  24. attribute EventHandler onprogress;
  25. attribute EventHandler onload;
  26. attribute EventHandler onabort;
  27. attribute EventHandler onerror;
  28. attribute EventHandler onloadend;
  29. };