Browser - Javascript - Binary large object (BLOB)

About

The blob object 1) is a data container.

Management

Creation

Example for a plain text object

let textBlob = new Blob( ["foo"], { type: 'text/plain' });

Read

Reading a blob is an async operation

  • With the Blob interface
(async  () => {
    let text = await textBlob.text();
    console.log(`Result from Blob Interface ${text}`);
})();
var reader = new FileReader();
reader.readAsText(textBlob);
reader.addEventListener("load", () => {
    console.log(`Result from file reader ${reader.result}`);
}, false);
(async  () => {
    let text = await (new Response(textBlob)).text();
    console.log(`Result from Response ${text}`);
})();

Result

Properties

Library


Powered by ComboStrap