JavaScript Blob

Beginner
6 min read
Updated: Nov 2026

Definition and Usage

A Blob holds immutable raw data. Files are Blobs. Use text(), arrayBuffer(), or object URLs for previews.

JavaScript Syntax

JavaScript
const b = new Blob(["hi"], { type: "text/plain" });
console.log(b.size);
console.log(b.type);
b.text().then(console.log);
Try it Editor

How It Works

  1. Construct. From parts.
  2. type. MIME type.
  3. text(). Decode as UTF-8.

Examples

Example 1 — Demo

Core usage.

JavaScript
const b = new Blob(["hi"], { type: "text/plain" });
console.log(b.size);
console.log(b.type);
b.text().then(console.log);
Try it Editor

How It Works

  1. Construct. From parts.
  2. type. MIME type.
  3. text(). Decode as UTF-8.

Frequently Asked Questions

A Blob holds immutable raw data. Files are Blobs. Use text(), arrayBuffer(), or object URLs for previews.
See JavaScript File handling for the end-to-end input → read flow.

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful