Blob.prototype.text

Returns a promise that resolves with a string containing the entire contents of the blob as text.

The blob contents is decoded from UTF-8.

Syntax

text()

Return value

A promise that resolves with a string.

If the contents of blob doesn’t fit in a string, the promise is rejected with a RangeError.

Example

let blob = new Blob(['Hello, world!'])
blob.text().then(result => {
  print(result)
})
Hello, world!