Skip to content

Commit f131dc6

Browse files
jmsb02targos
authored andcommittedOct 2, 2024
doc: add documentation for blob.bytes() method
PR-URL: #54114 Fixes: #54105 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
1 parent b6e8305 commit f131dc6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎doc/api/buffer.md

+17
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,23 @@ added:
513513
Returns a promise that fulfills with an {ArrayBuffer} containing a copy of
514514
the `Blob` data.
515515

516+
#### `blob.bytes()`
517+
518+
<!-- YAML
519+
added:
520+
- v22.3.0
521+
- v20.16.0
522+
-->
523+
524+
The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
525+
526+
```js
527+
const blob = new Blob(['hello']);
528+
blob.bytes().then((bytes) => {
529+
console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
530+
});
531+
```
532+
516533
### `blob.size`
517534

518535
<!-- YAML

0 commit comments

Comments
 (0)
Please sign in to comment.