1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

Blob.arrayBuffer returns uint8array (#7086)

This commit is contained in:
crowlKats 2020-08-17 23:46:08 +02:00 committed by GitHub
parent 974215afdd
commit b44b7a9a60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -151,7 +151,7 @@
bytes.set(chunk, offs);
offs += chunk.byteLength;
}
return bytes;
return bytes.buffer;
} else {
throw new TypeError("Invalid reader result.");
}

View file

@ -91,6 +91,12 @@ unitTest(async function blobStream(): Promise<void> {
assertEquals(decode(bytes), "Hello World");
});
unitTest(async function blobArrayBuffer(): Promise<void> {
const uint = new Uint8Array([102, 111, 111]);
const blob = new Blob([uint]);
assertEquals(await blob.arrayBuffer(), uint.buffer);
});
unitTest(function blobConstructorNameIsBlob(): void {
const blob = new Blob();
assertEquals(blob.constructor.name, "Blob");