diff options
Diffstat (limited to 'ext/web/09_file.js')
-rw-r--r-- | ext/web/09_file.js | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/ext/web/09_file.js b/ext/web/09_file.js index 482a14012..7c1d79ce3 100644 --- a/ext/web/09_file.js +++ b/ext/web/09_file.js @@ -387,14 +387,9 @@ class Blob { } /** - * @returns {Promise<string>} + * @param {number} size + * @returns {Promise<Uint8Array>} */ - async text() { - webidl.assertBranded(this, BlobPrototype); - const buffer = await this.#u8Array(this.size); - return core.decode(buffer); - } - async #u8Array(size) { const bytes = new Uint8Array(size); const partIterator = toIterator(this[_parts]); @@ -414,6 +409,15 @@ class Blob { } /** + * @returns {Promise<string>} + */ + async text() { + webidl.assertBranded(this, BlobPrototype); + const buffer = await this.#u8Array(this.size); + return core.decode(buffer); + } + + /** * @returns {Promise<ArrayBuffer>} */ async arrayBuffer() { @@ -422,6 +426,14 @@ class Blob { return TypedArrayPrototypeGetBuffer(buf); } + /** + * @returns {Promise<Uint8Array>} + */ + async bytes() { + webidl.assertBranded(this, BlobPrototype); + return await this.#u8Array(this.size); + } + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { return inspect( createFilteredInspectProxy({ |