JavaScript Objects: Blob

By: Dusty Arlia
Published on Friday, October 24, 2014 at 4:32 PM
Last Updated on Sunday, July 05, 2015 at 7:02 PM
Total Updates: 4

The Blob JavaScript object gets its name from SQL databases, where it mean "Binary Large Data". Blobs often represent binary data (raw data) and are often used as a data exchange format. They are file-like immutable objects. They can be read from or written to the Web, filesystems, and databases. You can access Blobs as plain text, typed arrays, or as URLs.

Create a Blob using the Blob() constructor or use the slice() method to create a blob that contains a subset of another blob's data.

Blobs can be stored in the web browser's memory or on disk for very large Blobs. The APIs for working with Blobs are asynchronous because of their size (web workers can use a synchronous version).

Get a Blob by:

*JavaScript File objects are subtypes of Blob objects (Files are Blobs with names and modification dates). Get a File using the <input type="file"> HTML <form> element and using the drag-and-drop API or Filesystem API.