UNPKG

@fastly/as-fetch

Version:

![npm version](https://img.shields.io/npm/v/@fastly/as-fetch) ![npm downloads per month](https://img.shields.io/npm/dm/@fastly/as-fetch)

79 lines (41 loc) 1.2 kB
[@fastly/as-fetch](../README.md) / Body # Class: Body Body for [Fetch HTTP Requests and Responses](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Body). ## Hierarchy - **Body** ↳ [Response](response.md) ↳ [Request](request.md) ## Table of contents ### Constructors - [constructor](body.md#constructor) ### Accessors - [bodyUsed](body.md#bodyused) ### Methods - [arrayBuffer](body.md#arraybuffer) - [text](body.md#text) ## Constructors ### constructor • **new Body**(`body`) The constructor for the `Body` class. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `body` | ``null`` \| `ArrayBuffer` | An optional array buffer to initialize the body. | ## Accessors ### bodyUsed`get` **bodyUsed**(): `boolean` #### Returns `boolean` A boolean representing whether the Body has been consumed already or not. ## Methods ### arrayBuffer ▸ **arrayBuffer**(): ``null`` \| `ArrayBuffer` #### Returns ``null`` \| `ArrayBuffer` an `ArrayBuffer` for the Body content (if it contains one). ___ ### text ▸ **text**(): `string` #### Returns `string` a string representation of the Body `ArrayBuffer` content.