---
title: FormData
summary: Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/globals/interface.FormData/
---

**Kind:** Interface  
**Module:** [globals](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/globals/)  
**Package:** @fastly/js-compute 4.0.1  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1297

Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)

## Constructor

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1326

```javascript
new FormData(form?: any)
```

**Parameters**

- `form`: `any` (optional)

## Methods

### append

_Overload 1 of 3_

```javascript
append(name: string, value: string | Blob): void
```

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1299

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)

**Parameters**

- `name`: `string`
- `value`: `string | Blob`

**Returns**

`void`

_Overload 2 of 3_

```javascript
append(name: string, value: string): void
```

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1300

**Parameters**

- `name`: `string`
- `value`: `string`

**Returns**

`void`

_Overload 3 of 3_

```javascript
append(name: string, blobValue: Blob, filename?: string): void
```

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1301

**Parameters**

- `name`: `string`
- `blobValue`: `Blob`
- `filename`: `string` (optional)

**Returns**

`void`

### delete

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1303

```javascript
delete(name: string): void
```

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)

**Parameters**

- `name`: `string`

**Returns**

`void`

### forEach

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1314

```javascript
forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void
```

**Parameters**

- `callbackfn`: `(value: FormDataEntryValue, key: string, parent: FormData) => void`
- `thisArg`: `any` (optional)

**Returns**

`void`

### get

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1305

```javascript
get(name: string): FormDataEntryValue | null
```

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)

**Parameters**

- `name`: `string`

**Returns**

`FormDataEntryValue | null`

### getAll

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1307

```javascript
getAll(name: string): Array<FormDataEntryValue>
```

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)

**Parameters**

- `name`: `string`

**Returns**

`Array<FormDataEntryValue>`

### has

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1309

```javascript
has(name: string): boolean
```

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)

**Parameters**

- `name`: `string`

**Returns**

`boolean`

### set

_Overload 1 of 3_

```javascript
set(name: string, value: string | Blob): void
```

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1311

[MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)

**Parameters**

- `name`: `string`
- `value`: `string | Blob`

**Returns**

`void`

_Overload 2 of 3_

```javascript
set(name: string, value: string): void
```

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1312

**Parameters**

- `name`: `string`
- `value`: `string`

**Returns**

`void`

_Overload 3 of 3_

```javascript
set(name: string, blobValue: Blob, filename?: string): void
```

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1313

**Parameters**

- `name`: `string`
- `blobValue`: `Blob`
- `filename`: `string` (optional)

**Returns**

`void`
