mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
fix(op_crates/web) let TextEncoder#encodeInto accept detached ArrayBuffers (#9143)
This commit is contained in:
parent
6a50615e7c
commit
db3a1d6633
2 changed files with 22 additions and 3 deletions
|
@ -1134,14 +1134,16 @@
|
|||
return new Uint8Array(output);
|
||||
}
|
||||
encodeInto(input, dest) {
|
||||
const encoder = new UTF8Encoder();
|
||||
const inputStream = new Stream(stringToCodePoints(input));
|
||||
|
||||
if (!(dest instanceof Uint8Array)) {
|
||||
throw new TypeError(
|
||||
"2nd argument to TextEncoder.encodeInto must be Uint8Array",
|
||||
);
|
||||
}
|
||||
if (dest.byteLength === 0) {
|
||||
return { read: 0, written: 0 };
|
||||
}
|
||||
const encoder = new UTF8Encoder();
|
||||
const inputStream = new Stream(stringToCodePoints(input));
|
||||
|
||||
let written = 0;
|
||||
let read = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue