AwaitedDOM / Blob
Blob
object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream
so its methods can be used for processing the data.File
interface is based on Blob
, inheriting blob functionality and expanding it to support files on the user's system.Properties
.size W3C {#size}
The size, in bytes, of the data contained in the Blob
object.
Type: Promise<number>
.type W3C {#type}
A string indicating the MIME type of the data contained in the Blob
. If the type is unknown, this string is empty.
Type: Promise<string>
Methods
.arrayBuffer*()* W3C {#arrayBuffer}
Returns a promise that resolves with an ArrayBuffer
containing the entire contents of the Blob
as binary data.
Returns: Promise<ArrayBuffer>
.slice*(start?, end?, contentType?)* W3C {#slice}
Returns a new Blob
object containing the data in the specified range of bytes of the blob on which it's called.
Arguments:
start
number
. An index into theBlob
indicating the first byte to include in the newBlob
. If you specify a negative value, it's treated as an offset from the end of theBlob
toward the beginning. For example, -10 would be the 10th from last byte in theBlob
. The default value is 0. If you specify a value forstart
that is larger than the size of the sourceBlob
, the returnedBlob
has size 0 and contains no data.end
number
. An index into theBlob
indicating the first byte that will not be included in the newBlob
(i.e. the byte exactly at this index is not included). If you specify a negative value, it's treated as an offset from the end of theBlob
toward the beginning. For example, -10 would be the 10th from last byte in theBlob
. The default value issize
.contentType
string
. The content type to assign to the newBlob
; this will be the value of itstype
property. The default value is an empty string.
Returns: Promise<Blob>
.text*()* W3C {#text}
Returns a promise that resolves with a string
containing the entire contents of the Blob
interpreted as UTF-8 text.
Returns: Promise<string>
Unimplemented Specs
Methods
stream() |