From 3a25717fce5d8bea1146aa0726576c97ba20c0ab Mon Sep 17 00:00:00 2001 From: jaexxin Date: Tue, 30 Jul 2024 14:27:28 +0900 Subject: [PATCH] doc: add documentation for blob.bytes() method Add documentation for blob.bytes() method doc: add documentation for blob.bytes() method --- doc/api/buffer.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index c72590cb71538c..30d272c5ced5ae 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -538,6 +538,17 @@ added: Creates and returns a new `Blob` containing a subset of this `Blob` objects data. The original `Blob` is not altered. +#### `blob.bytes()` + +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 ] +}); +``` + ### `blob.stream()`