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 <daeyeon.dev@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
  • Loading branch information
jmsb02 authored and jakecastelli committed Aug 4, 2024
1 parent ea5e77b commit 76d10a1
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 76d10a1

Please sign in to comment.