Web APIs

Blob.prototype.slice()

Try the free JavaScript compiler

Creates a new Blob for a byte interval; end is exclusive.

Formal Syntax & Structure

javascript syntaxjavascript
blob.slice(start, end, contentType)

Parameters & Attributes

NameTypeDescription
startnumberStart byte position.
endnumberExclusive end byte position.
contentTypestringMedia type for result.

Return Value

Blob

Creates a new Blob for a byte interval; end is exclusive.

Working Example

Example Snippetjavascript
(async () => {const b=new Blob(["abcd"]);console.log(await b.slice(1,3).text());})()
JavaScript Reference