- Notifications
You must be signed in to change notification settings - Fork 22.7k
/
Copy pathindex.md
53 lines (35 loc) · 922 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
title: "Request: arrayBuffer() method"
short-title: arrayBuffer()
slug: Web/API/Request/arrayBuffer
page-type: web-api-instance-method
browser-compat: api.Request.arrayBuffer
---
{{APIRef("Fetch API")}}{{AvailableInWorkers}}
The **`arrayBuffer()`** method of the {{domxref("Request")}} interface
reads the request body and returns it as a promise that resolves with an {{jsxref("ArrayBuffer")}}.
## Syntax
```js-nolint
arrayBuffer()
```
### Parameters
None.
### Return value
A promise that resolves with an {{jsxref("ArrayBuffer")}}.
## Examples
```js
constmyArray=newUint8Array(10);
constrequest=newRequest("/myEndpoint", {
method:"POST",
body: myArray,
});
request.arrayBuffer().then((buffer) => {
// do something with the buffer sent in the request
});
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("Response.arrayBuffer()")}}