Blobs in Javascript

Posted By : Ankit Uniyal | 12-Jan-2017

In this blog, we will discuss quick introduction of Blobs in javascript :

Blobs is bascially a chuck of bytes which can holds data of a file.It represents as the central data exchange format for a variety of new binary data API's.The name inherits from SQL databases which means "Binary Large Object".As it represents binary data and it can be large but neither is required as it could also specify the content of an small text file.

A Client side javascript object is a subtype of Blob i.e a File is just a Blob of data with name and modification date.It is an immutable objects which represents raw data.

var blob = new Blob();

console.log(blob.size);
console.log(blob.type);

Blobs actually allows you to construct file like objects that can be passed to API's which expects URL instead of providing the file by server.

Like for an example, you can construct a blob which contains data for an image via URL.createObjectURL() which generates an URL and the same will send to HTMLImageElement.src which displays we created.

Thanks

About Author

Author Image
Ankit Uniyal

Ankit has knowledge in Javascript, NodeJS, AngularJS and MongoDB also have experience in using AWS Services.

Request for Proposal

Name is required

Comment is required

Sending message..