0Pricing
JavaScript Academy · Lesson

Blobs and Object URLs

Create and use blob URLs for downloads.

What Is a Blob?

A Blob (Binary Large Object) represents immutable raw data, such as file contents, in memory. Files are a special kind of Blob with a name and modified date.

Blobs let you build, slice, and download binary data in the browser.

Creating a Blob

Construct a Blob from an array of parts (strings, buffers, other Blobs) and an options object specifying the MIME type.

const blob = new Blob(['Hello, world!'], { type: 'text/plain' });

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

All lessons in this course

  1. The FormData Object
  2. Reading Files with FileReader
  3. Blobs and Object URLs
  4. Uploading Files with Fetch
← Back to JavaScript Academy