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
- The FormData Object
- Reading Files with FileReader
- Blobs and Object URLs
- Uploading Files with Fetch