Skip to main content
Version: 3.33.2

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 the Blob. The default value is 0.
  • 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 the Blob. The default value is size.
  • contentType optional
    • : A string indicating the content type to assign to the new Blob. The default value is an empty string.

Return value

A new Blob object containing the specified subset of data.