9
9
*/
10
10
package org .scalajs .dom .raw
11
11
12
+ import org .scalajs .dom .experimental .ReadableStream
12
13
import scala .scalajs .js
13
14
import scala .scalajs .js .annotation ._
14
15
import scala .scalajs .js .typedarray .ArrayBuffer
@@ -7839,14 +7840,18 @@ object BlobPropertyBag {
7839
7840
}
7840
7841
7841
7842
/**
7842
- * A Blob object represents a file-like object of immutable, raw data. Blobs
7843
- * represent data that isn't necessarily in a JavaScript-native format. The File
7844
- * interface is based on Blob, inheriting blob functionality and expanding it to
7845
- * support files on the user's system.
7843
+ * A Blob object represents a file-like object of immutable, raw data; they can be
7844
+ * read as text or binary data, or converted into a ReadableStream so its methods
7845
+ * can be used for processing the data. Blobs can represent data that isn't
7846
+ * necessarily in a JavaScript-native format. The File interface is based on Blob,
7847
+ * inheriting blob functionality and expanding it to support files on the user's system.
7846
7848
*
7847
- * An easy way to construct a Blob is by invoking the Blob constuctor. Another
7848
- * way is to use the slice() method to create a blob that contains a subset of
7849
- * another blob's data.
7849
+ * To construct a Blob from other non-blob objects and data, use the Blob()
7850
+ * constructor. To create a blob that contains a subset of another blob's data, use the
7851
+ * slice() method. To obtain a Blob object for a file on the user's file system, see
7852
+ * the File documentation.
7853
+ *
7854
+ * The APIs accepting Blob objects are also listed in the File documentation.
7850
7855
*
7851
7856
* MDN
7852
7857
*/
@@ -7856,7 +7861,10 @@ class Blob(blobParts: js.Array[js.Any] = js.native,
7856
7861
options : BlobPropertyBag = js.native)
7857
7862
extends js.Object {
7858
7863
7859
- def `type` : String = js.native
7864
+ @ deprecated(
7865
+ " This method seems to have been added in error and not actually exist." ,
7866
+ " 1.2.0" )
7867
+ def close (): Unit = js.native
7860
7868
7861
7869
/**
7862
7870
* The size, in bytes, of the data contained in the Blob object.
@@ -7866,15 +7874,44 @@ class Blob(blobParts: js.Array[js.Any] = js.native,
7866
7874
def size : Double = js.native
7867
7875
7868
7876
/**
7869
- * The slice is used to create a new Blob object containing the data in the specified
7870
- * range of bytes of the source Blob.
7877
+ * A string indicating the MIME type of the data contained in the Blob. If the type
7878
+ * is unknown, this string is empty.
7879
+ *
7880
+ * MDN
7881
+ */
7882
+ def `type` : String = js.native
7883
+
7884
+ /**
7885
+ * A string indicating the MIME type of the data contained in the Blob. If the type
7886
+ * is unknown, this string is empty.
7871
7887
*
7872
7888
* MDN
7873
7889
*/
7874
7890
def slice (start : Double = js.native, end : Double = js.native,
7875
7891
contentType : String = js.native): Blob = js.native
7876
7892
7877
- def close (): Unit = js.native
7893
+ /**
7894
+ * Returns a ReadableStream that can be used to read the contents of the blob.
7895
+ *
7896
+ * MDN
7897
+ */
7898
+ def stream (): ReadableStream [Byte ] = js.native
7899
+
7900
+ /**
7901
+ * Returns a promise that resolves with a USVString containing the entire
7902
+ * contents of the blob interpreted as UTF-8 text.
7903
+ *
7904
+ * MDN
7905
+ *
7906
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/USVString
7907
+ */
7908
+ def text (): js.Promise [String ] = js.native
7909
+
7910
+ /**
7911
+ * Returns a promise that resolves with an ArrayBuffer containing the entire
7912
+ * contents of the blob as binary data.
7913
+ */
7914
+ def arrayBuffer (): js.Promise [ArrayBuffer ] = js.native
7878
7915
}
7879
7916
7880
7917
@ js.native
0 commit comments