Skip to main content
Blob - node__buffer.d.ts - Node documentation
class Blob

Usage in Deno

```typescript import { Blob } from "node:node__buffer.d.ts"; ```
A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across multiple worker threads.

Constructors

new
Blob(
sources: Array<
ArrayBuffer
| BinaryLike
| Blob
>
,
options?: BlobOptions,
)
Creates a new `Blob` object containing a concatenation of the given sources. {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into the 'Blob' and can therefore be safely modified after the 'Blob' is created. String sources are also copied into the `Blob`.

Properties

readonly
size: number
The total size of the `Blob` in bytes.
readonly
type: string
The content-type of the `Blob`.

Methods

arrayBuffer(): Promise<ArrayBuffer>
Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of the `Blob` data.
bytes(): Promise<Uint8Array>
The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise`. ```js const blob = new Blob(['hello']); blob.bytes().then((bytes) => { console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ] }); ```
slice(
start?: number,
end?: number,
type?: string,
): Blob
Creates and returns a new `Blob` containing a subset of this `Blob` objects data. The original `Blob` is not altered.
stream(): WebReadableStream
Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
text(): Promise<string>
Returns a promise that fulfills with the contents of the `Blob` decoded as a UTF-8 string.
interface Blob
extends _Blob
variable Blob
`Blob` class is a global reference for `import { Blob } from 'node:buffer'` https://nodejs.org/api/buffer.html#class-blob

Type

globalThis extends { onmessage: any; Blob: infer T; } ? T : buffer