Use Response.prototype.bytes() more in the code-base (PR 20651 follow-up)

This commit is contained in:
Jonas Jenwald 2026-03-07 15:50:36 +01:00
parent aaf9b3bad0
commit 0c514b008b
3 changed files with 3 additions and 6 deletions

View File

@ -29,7 +29,7 @@ const response = await fetch(JPEG_IMAGE);
if (!response.ok) { if (!response.ok) {
throw new Error(response.statusText); throw new Error(response.statusText);
} }
const typedArrayImage = new Uint8Array(await response.arrayBuffer()); const typedArrayImage = await response.bytes();
// Parse the image data using `JpegImage`. // Parse the image data using `JpegImage`.
// //

View File

@ -85,8 +85,7 @@ async function writeStream(stream, buffer, transform) {
.catch(() => {}); .catch(() => {});
// Response::text doesn't return the correct data. // Response::text doesn't return the correct data.
const buf = await new Response(cs.readable).arrayBuffer(); bytes = await new Response(cs.readable).bytes();
bytes = new Uint8Array(buf);
let newFilter, newParams; let newFilter, newParams;
if (!filter) { if (!filter) {

View File

@ -746,9 +746,7 @@ class SignatureExtractor {
writer.close(); writer.close();
const buf = await new Response(cs.readable).arrayBuffer(); const bytes = await new Response(cs.readable).bytes();
const bytes = new Uint8Array(buf);
return bytes.toBase64(); return bytes.toBase64();
} }