Victor Porof | 6e09692 | 2022-06-10 13:01:05 +0000 | [diff] [blame] | 1 | // GENERATED CONTENT - DO NOT EDIT |
| 2 | // Content was automatically extracted by Reffy into webref |
| 3 | // (https://github.com/w3c/webref) |
| 4 | // Source: File API (https://w3c.github.io/FileAPI/) |
| 5 | |
| 6 | [Exposed=(Window,Worker), Serializable] |
| 7 | interface Blob { |
| 8 | constructor(optional sequence<BlobPart> blobParts, |
| 9 | optional BlobPropertyBag options = {}); |
| 10 | |
| 11 | readonly attribute unsigned long long size; |
| 12 | readonly attribute DOMString type; |
| 13 | |
| 14 | // slice Blob into byte-ranged chunks |
| 15 | Blob slice(optional [Clamp] long long start, |
| 16 | optional [Clamp] long long end, |
| 17 | optional DOMString contentType); |
| 18 | |
| 19 | // read from the Blob. |
| 20 | [NewObject] ReadableStream stream(); |
| 21 | [NewObject] Promise<USVString> text(); |
| 22 | [NewObject] Promise<ArrayBuffer> arrayBuffer(); |
| 23 | }; |
| 24 | |
| 25 | enum EndingType { "transparent", "native" }; |
| 26 | |
| 27 | dictionary BlobPropertyBag { |
| 28 | DOMString type = ""; |
| 29 | EndingType endings = "transparent"; |
| 30 | }; |
| 31 | |
| 32 | typedef (BufferSource or Blob or USVString) BlobPart; |
| 33 | |
| 34 | [Exposed=(Window,Worker), Serializable] |
| 35 | interface File : Blob { |
| 36 | constructor(sequence<BlobPart> fileBits, |
| 37 | USVString fileName, |
| 38 | optional FilePropertyBag options = {}); |
| 39 | readonly attribute DOMString name; |
| 40 | readonly attribute long long lastModified; |
| 41 | }; |
| 42 | |
| 43 | dictionary FilePropertyBag : BlobPropertyBag { |
| 44 | long long lastModified; |
| 45 | }; |
| 46 | |
| 47 | [Exposed=(Window,Worker), Serializable] |
| 48 | interface FileList { |
| 49 | getter File? item(unsigned long index); |
| 50 | readonly attribute unsigned long length; |
| 51 | }; |
| 52 | |
| 53 | [Exposed=(Window,Worker)] |
| 54 | interface FileReader: EventTarget { |
| 55 | constructor(); |
| 56 | // async read methods |
| 57 | undefined readAsArrayBuffer(Blob blob); |
| 58 | undefined readAsBinaryString(Blob blob); |
| 59 | undefined readAsText(Blob blob, optional DOMString encoding); |
| 60 | undefined readAsDataURL(Blob blob); |
| 61 | |
| 62 | undefined abort(); |
| 63 | |
| 64 | // states |
| 65 | const unsigned short EMPTY = 0; |
| 66 | const unsigned short LOADING = 1; |
| 67 | const unsigned short DONE = 2; |
| 68 | |
| 69 | readonly attribute unsigned short readyState; |
| 70 | |
| 71 | // File or Blob data |
| 72 | readonly attribute (DOMString or ArrayBuffer)? result; |
| 73 | |
| 74 | readonly attribute DOMException? error; |
| 75 | |
| 76 | // event handler content attributes |
| 77 | attribute EventHandler onloadstart; |
| 78 | attribute EventHandler onprogress; |
| 79 | attribute EventHandler onload; |
| 80 | attribute EventHandler onabort; |
| 81 | attribute EventHandler onerror; |
| 82 | attribute EventHandler onloadend; |
| 83 | }; |
| 84 | |
| 85 | [Exposed=(DedicatedWorker,SharedWorker)] |
| 86 | interface FileReaderSync { |
| 87 | constructor(); |
| 88 | // Synchronously return strings |
| 89 | |
| 90 | ArrayBuffer readAsArrayBuffer(Blob blob); |
| 91 | DOMString readAsBinaryString(Blob blob); |
| 92 | DOMString readAsText(Blob blob, optional DOMString encoding); |
| 93 | DOMString readAsDataURL(Blob blob); |
| 94 | }; |
| 95 | |
| 96 | [Exposed=(Window,DedicatedWorker,SharedWorker)] |
| 97 | partial interface URL { |
| 98 | static DOMString createObjectURL((Blob or MediaSource) obj); |
| 99 | static undefined revokeObjectURL(DOMString url); |
| 100 | }; |