Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add content for Blob.bytes() #54121

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,18 @@ added:
Returns a promise that fulfills with an {ArrayBuffer} containing a copy of
the `Blob` data.

### `blob.bytes()`

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

* Returns: {Promise}

Returns a promise that fulfills with a {Uint8Array} containing a copy of the
`Blob` data.

### `blob.size`

<!-- YAML
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ class Blob {
return dec.decode(await this.arrayBuffer());
}

/**
* @returns {Promise<Uint8Array>}
*/

bytes() {
if (!isBlob(this))
throw new ERR_INVALID_THIS('Blob');
Expand Down
Loading