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:
parent
974215afdd
commit
b44b7a9a60
2 changed files with 7 additions and 1 deletions
|
@ -151,7 +151,7 @@
|
||||||
bytes.set(chunk, offs);
|
bytes.set(chunk, offs);
|
||||||
offs += chunk.byteLength;
|
offs += chunk.byteLength;
|
||||||
}
|
}
|
||||||
return bytes;
|
return bytes.buffer;
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError("Invalid reader result.");
|
throw new TypeError("Invalid reader result.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,12 @@ unitTest(async function blobStream(): Promise<void> {
|
||||||
assertEquals(decode(bytes), "Hello World");
|
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 {
|
unitTest(function blobConstructorNameIsBlob(): void {
|
||||||
const blob = new Blob();
|
const blob = new Blob();
|
||||||
assertEquals(blob.constructor.name, "Blob");
|
assertEquals(blob.constructor.name, "Blob");
|
||||||
|
|
Loading…
Reference in a new issue