Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  13] [ 6]  / answers: 1 / hits: 173795  / 10 Years ago, sat, april 12, 2014, 12:00:00

I have a string that I called Blob() on:



var mystring = Hello World!;
var myblob = new Blob([mystring], {
type: 'text/plain'
});
mystring = ;


How do I get the string back out?



function getBlobData(blob) {
// Not sure what code to put here
}
alert(getBlobData(myblob)); // should alert Hello World!

More From » html

 Answers
36

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);

[#71497] Thursday, April 10, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
keyanah

Total Points: 642
Total Questions: 93
Total Answers: 114

Location: Virgin Islands (U.S.)
Member since Tue, Jul 7, 2020
4 Years ago
;