9
9
*/
10
10
package org .scalajs .dom .raw
11
11
12
+ import org .scalajs .dom .experimental .ReadableStream
13
+
12
14
import scala .scalajs .js
13
15
import scala .scalajs .js .annotation ._
14
16
import scala .scalajs .js .typedarray .ArrayBuffer
@@ -7970,14 +7972,18 @@ object BlobPropertyBag {
7970
7972
}
7971
7973
7972
7974
/**
7973
- * A Blob object represents a file-like object of immutable, raw data. Blobs
7974
- * represent data that isn't necessarily in a JavaScript-native format. The File
7975
- * interface is based on Blob, inheriting blob functionality and expanding it to
7976
- * support files on the user's system.
7975
+ * A Blob object represents a file-like object of immutable, raw data; they can be
7976
+ * read as text or binary data, or converted into a ReadableStream so its methods
7977
+ * can be used for processing the data. Blobs can represent data that isn't
7978
+ * necessarily in a JavaScript-native format. The File interface is based on Blob,
7979
+ * inheriting blob functionality and expanding it to support files on the user's system.
7980
+ *
7981
+ * To construct a Blob from other non-blob objects and data, use the Blob()
7982
+ * constructor. To create a blob that contains a subset of another blob's data, use the
7983
+ * slice() method. To obtain a Blob object for a file on the user's file system, see
7984
+ * the File documentation.
7977
7985
*
7978
- * An easy way to construct a Blob is by invoking the Blob constuctor. Another
7979
- * way is to use the slice() method to create a blob that contains a subset of
7980
- * another blob's data.
7986
+ * The APIs accepting Blob objects are also listed in the File documentation.
7981
7987
*
7982
7988
* MDN
7983
7989
*/
@@ -7987,8 +7993,6 @@ class Blob(blobParts: js.Array[js.Any] = js.native,
7987
7993
options : BlobPropertyBag = js.native)
7988
7994
extends js.Object {
7989
7995
7990
- def `type` : String = js.native
7991
-
7992
7996
/**
7993
7997
* The size, in bytes, of the data contained in the Blob object.
7994
7998
*
@@ -7997,15 +8001,44 @@ class Blob(blobParts: js.Array[js.Any] = js.native,
7997
8001
def size : Double = js.native
7998
8002
7999
8003
/**
8000
- * The slice is used to create a new Blob object containing the data in the specified
8001
- * range of bytes of the source Blob.
8004
+ * A string indicating the MIME type of the data contained in the Blob. If the type
8005
+ * is unknown, this string is empty.
8006
+ *
8007
+ * MDN
8008
+ */
8009
+ def `type` : String = js.native
8010
+
8011
+ /**
8012
+ * A string indicating the MIME type of the data contained in the Blob. If the type
8013
+ * is unknown, this string is empty.
8002
8014
*
8003
8015
* MDN
8004
8016
*/
8005
8017
def slice (start : Double = js.native, end : Double = js.native,
8006
8018
contentType : String = js.native): Blob = js.native
8007
8019
8008
- def close (): Unit = js.native
8020
+ /**
8021
+ * Returns a ReadableStream that can be used to read the contents of the blob.
8022
+ *
8023
+ * MDN
8024
+ */
8025
+ def stream (): ReadableStream [Byte ] = js.native
8026
+
8027
+ /**
8028
+ * Returns a promise that resolves with a USVString containing the entire
8029
+ * contents of the blob interpreted as UTF-8 text.
8030
+ *
8031
+ * MDN
8032
+ *
8033
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/USVString
8034
+ */
8035
+ def text (): scala.scalajs.js.Promise [String ] = js.native
8036
+
8037
+ /**
8038
+ * Returns a promise that resolves with an ArrayBuffer containing the entire
8039
+ * contents of the blob as binary data.
8040
+ */
8041
+ def arrayBuffer (): scala.scalajs.js.Promise [ArrayBuffer ] = js.native
8009
8042
}
8010
8043
8011
8044
@ js.native
0 commit comments