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]
7interface 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
25enum EndingType { "transparent", "native" };
26
27dictionary BlobPropertyBag {
28  DOMString type = "";
29  EndingType endings = "transparent";
30};
31
32typedef (BufferSource or Blob or USVString) BlobPart;
33
34[Exposed=(Window,Worker), Serializable]
35interface 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
43dictionary FilePropertyBag : BlobPropertyBag {
44  long long lastModified;
45};
46
47[Exposed=(Window,Worker), Serializable]
48interface FileList {
49  getter File? item(unsigned long index);
50  readonly attribute unsigned long length;
51};
52
53[Exposed=(Window,Worker)]
54interface 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)]
86interface 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)]
97partial interface URL {
98  static DOMString createObjectURL((Blob or MediaSource) obj);
99  static undefined revokeObjectURL(DOMString url);
100};
101