JS Built-ins
Blobintermediate

Blob.slice β€” slice from offset

πŸ“– Usage Example
const b = new Blob(['data'], { type: 'text/plain' })
const s = b.slice(0, 2, 'text/html')
s.type  // β†’ 'text/html'

Pass a MIME type as the third argument to change the type of the sliced Blob.

Blob.slice() from Offset

blob.slice(start) slices from start to the end of the Blob.

new Blob(['hello']).slice(2).size equals 3 ('llo' = 3 bytes).

Challenge: Verify that new Blob(['hello']).slice(2).size === 3.

πŸ’‘ Hints (1)
  • β€’ Omitting the end argument slices to the end of the Blob.