st button = document.createElement("button");
        button.textContent = "View live result of the example code above";
        p.append(button);
        button.addEventListener("click", () => window.open(location.href));
        return true;
      }
      return false;
    }
    
    if (!showViewLiveResultButton()) {
      function typedArrayToURL(typedArray, mimeType) {
        return URL.createObjectURL(
          new Blob([typedArray.buffer], { type: mimeType }),
        );
      }
      const bytes = new Uint8Array(59);
    
      for (let i = 0; i < 59; i++) {
        bytes[i] = 32 + i;
      }
    
      const url = typedArrayToURL(bytes, "text/plain");
    
      const link = document.createElement("a");
      link.href = url;
      link.innerText = "Open the array URL";
    
      document.body.appendChild(link);
    }
    

####  Result

###  Extracting data from a blob

One way to read content from a ` Blob ` is to use a [ ` FileReader ` ](/en-
US/docs/Web/API/FileReader) . The following code reads the content of a ` Blob
` as a typed array:

js

    
    
    const reader = new FileReader();
    reader.addEventListener("loadend", () => {
      // reader.result contains the contents of blob as a typed array
    });
    reader.readAsArrayBuffer(blob);
    

Another way to read content from a ` Blob ` is to use a [ ` Response ` ](/en-
US/docs/Web/API/Response) . The following code reads the content of a ` Blob `
as text:

js

    
    
    const text = await new Response(blob).text();
    

Or by using [ ` Blob.text() ` ](/en-US/docs/Web/API/Blob/text) :

js

    
    
    const text = await blob.text();
    

By using other methods of ` FileReader ` , it is possible to read the contents
of a Blob as a string or a data URL.

##  Specifications

Specification  
---  
[ File API  
#  blob-section  ](https://w3c.github.io/FileAPI/#blob-section)  
  
##  Browser compatibility

BCD tables only load in the browser  with JavaScript enabled. Enable
JavaScript to view data.

##  See also

  * [ ` FileReader ` ](/en-US/docs/Web/API/FileReader)
  * [ ` File ` ](/en-US/docs/Web/API/File)
  * [ ` URL.createObjectURL() ` ](/en-US/docs/Web/API/URL/createObjectURL_static "URL.createObjectURL\(\)")
  * [ Using files from web applications ](/en-US/docs/Web/API/File_API/Using_files_from_web_applications)

##  Help improve MDN

Was this page helpful to you?

Yes  No

[ Learn how to contribute
](https://github.com/mdn/content/blob/main/CONTRIBUTING.md "This will take you
to our contribution guidelines on GitHub.") .

This page was last modified on  Dec 2, 2023  by  [ MDN contributors ](/en-
US/docs/Web/API/Blob/contributors.txt) .

[ View this page on GitHub
](https://github.com/mdn/content/blob/main/files/en-
us/web/api/blob/index.md?plain=1 "Folder: en-us/web/api/blob \(Opens in a new
tab\)") â¢  [ Report a problem with this content
](https://github.com/mdn/content/issues/new?template=page-report.yml&mdn-
url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FAPI%2FBlob&metadata=%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EPage+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-
us%2Fweb%2Fapi%2Fblob%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FAPI%2FBlob%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-
us%2Fweb%2Fapi%2Fblob%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F84a9afd94f497d4173bde131731ef6bdf0b6135d%0A*+Document+last+modified%3A+2023-12-02T07%3A13%3A28.000Z%0A%0A%3C%2Fdetails%3E
"This will take you to GitHub to file a new issue.")

[ MDN logo  ](/)

Your blueprint for a better internet.

  * [ MDN on Mastodon  ](https://mozilla.social/@mdn)
  * [ MDN on X (formerly Twitter)  ](https://twitter.com/mozdevnet)
  * [ MDN on GitHub  ](https://github.com/mdn/)
  * [ MDN Blog RSS Feed  ](/en-US/blog/rss.xml)

##  MDN

  * [ About ](/en-US/about)
  * [ Blog ](/en-US/blog/)
  *