1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/FileAPI/#blob
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
13 typedef (BufferSource or Blob or UTF8String) BlobPart;
15 [Exposed=(Window,Worker)]
18 constructor(optional sequence<BlobPart> blobParts,
19 optional BlobPropertyBag options = {});
22 readonly attribute unsigned long long size;
24 readonly attribute DOMString type;
26 //slice Blob into byte-ranged chunks
29 Blob slice(optional [Clamp] long long start,
30 optional [Clamp] long long end,
31 optional DOMString contentType);
33 // read from the Blob.
34 [NewObject, Throws] ReadableStream stream();
35 [NewObject] Promise<USVString> text();
36 [NewObject] Promise<ArrayBuffer> arrayBuffer();
37 [NewObject] Promise<Uint8Array> bytes();
40 enum EndingType { "transparent", "native" };
42 dictionary BlobPropertyBag {
44 EndingType endings = "transparent";
47 partial interface Blob {
48 // This returns the type of BlobImpl used for this Blob.
50 readonly attribute DOMString blobImplType;