請求:bytes() 方法
注意:此功能在 Web Workers 中可用。
bytes() 方法是 Request 介面的一部分,它讀取請求體並返回一個 Promise,該 Promise 解析為一個 Uint8Array。
語法
js
bytes()
引數
無。
返回值
一個 Promise,它解析為一個 Uint8Array。
示例
js
const myArray = new Uint8Array(10);
const request = new Request("/myEndpoint", {
method: "POST",
body: myArray,
});
request.bytes().then((buffer) => {
// do something with the buffer sent in the request
});
規範
| 規範 |
|---|
| Fetch # dom-body-bytes |
瀏覽器相容性
載入中…