Skip to content

Commit

Permalink
doc: add documentation for blob.bytes() method
Browse files Browse the repository at this point in the history
PR-URL: #54114
Fixes: #54105
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Jake Yuesong Li <[email protected]>
  • Loading branch information
jmsb02 authored and targos committed Aug 14, 2024
1 parent db0a80a commit 11fdaa6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,23 @@ added:
Returns a promise that fulfills with an {ArrayBuffer} containing a copy of
the `Blob` data.

#### `blob.bytes()`

<!-- YAML
added:
- v22.3.0
- v20.16.0
-->

The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.

```js
const blob = new Blob(['hello']);
blob.bytes().then((bytes) => {
console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
});
```

### `blob.size`

<!-- YAML
Expand Down

0 comments on commit 11fdaa6

Please sign in to comment.