Blob.slice()
The slice()
method of the Blob
interface creates and returns a new Blob
object which contains data from a subset of the blob on which it's called.
Syntax
slice()
slice(start)
slice(start, end)
slice(start, end, contentType)
Parameters
start
optional- : The 0-based index of the first byte to include in the new
Blob
. If negative, it refers to an index from the end of theBlob
. The default value is 0.
- : The 0-based index of the first byte to include in the new
end
optional- : The 0-based index of the first byte that will not be included in the new
Blob
. If negative, it refers to an index from the end of theBlob
. The default value issize
.
- : The 0-based index of the first byte that will not be included in the new
contentType
optional- : A string indicating the content type to assign to the new
Blob
. The default value is an empty string.
- : A string indicating the content type to assign to the new
Return value
A new Blob
object containing the specified subset of data.