← Back to release summary

Fetch: Request.bytes() and Response.bytes()

Category
Network / Connectivity
Type
Chromium catches up
Status
Enabled by default (Chrome 132)
Intent stage
None

Summary

Add a bytes() method to the Request and Response interfaces, which returns a promise that resolves with a Uint8Array. While Request and Response have an arrayBuffer() method, we can't read directly from a buffer. We have to create a view such as a Uint8Array to read it. The bytes() method improves the ergonomics of getting the body of Request and Response.

Motivation

Add a bytes() method to the Request and Response interfaces, It improves the ergonomics of getting the body of Request and Response.

Standards & signals

View on chromestatus.com