blob to string javascript code example

Example 1: blob to text javascript

<RESPONSE PROMISE>
.then(r=>r.blob())
.then(r=>{
console.log(r.type)
return new Response(r)
})
.then(r=>
 r.text()
)
.then(console.log)

Example 2: blob to text javascript

var reader = new FileReader();
reader.onload = function() {
    alert(reader.result);
}
reader.readAsText(blob);

Example 3: js string to blob

In order to extract data from a Blob, you need a FileReader.

var reader = new FileReader();
reader.onload = function() {
    alert(reader.result);
}
reader.readAsText(blob);