Skip to content

FormData

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:15

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 fetch().

new FormData(): FormData;

FormData

[iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:105

An alias for FormData#entries()

SpecIterableIterator<[string, FormDataEntryValue]>


readonly [toStringTag]: string;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:107


entries: () => SpecIterableIterator<[string, FormDataEntryValue]>;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:100

Returns an iterator allowing to go through the FormData key/value pairs. The key of each pair is a string; the value is a FormDataValue.

SpecIterableIterator<[string, FormDataEntryValue]>


forEach: (callbackfn, thisArg?) => void;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:79

Executes given callback function for each field of the FormData instance

ParameterType
callbackfn(value, key, iterable) => void
thisArg?unknown

void


keys: () => SpecIterableIterator<string>;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:88

Returns an iterator allowing to go through all keys contained in this FormData object. Each key is a string.

SpecIterableIterator<string>


values: () => SpecIterableIterator<FormDataEntryValue>;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:94

Returns an iterator allowing to go through all values contained in this object FormData object. Each value is a FormDataValue.

SpecIterableIterator<FormDataEntryValue>

append(
name,
value,
fileName?): void;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:27

Appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.

The difference between set() and append() is that if the specified key already exists, set() will overwrite all existing values with the new one, whereas append() will append the new value onto the end of the existing set of values.

ParameterTypeDescription
namestringThe name of the field whose data is contained in value.
valueunknownThe field’s value. This can be Blob or File. If none of these are specified the value is converted to a string.
fileName?stringThe filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is “blob”. The default filename for File objects is the file’s filename.

void


delete(name): void;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:74

Deletes a key and its value(s) from a FormData object.

ParameterTypeDescription
namestringThe name of the key you want to delete.

void


get(name):
| null
| FormDataEntryValue;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:49

Returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead.

ParameterTypeDescription
namestringA name of the value you want to retrieve.

| null | FormDataEntryValue

A FormDataEntryValue containing the value. If the key doesn’t exist, the method returns null.


getAll(name): FormDataEntryValue[];

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:58

Returns all the values associated with a given key from within a FormData object.

ParameterTypeDescription
namestringA name of the value you want to retrieve.

FormDataEntryValue[]

An array of FormDataEntryValue whose key matches the value passed in the name parameter. If the key doesn’t exist, the method returns an empty list.


has(name): boolean;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:67

Returns a boolean stating whether a FormData object contains a certain key.

ParameterTypeDescription
namestringA string representing the name of the key you want to test for.

boolean

A boolean value.


set(
name,
value,
fileName?): void;

Defined in: node_modules/.pnpm/undici-types@7.13.0/node_modules/undici-types/formdata.d.ts:39

Set a new value for an existing key inside FormData, or add the new field if it does not already exist.

ParameterTypeDescription
namestringThe name of the field whose data is contained in value.
valueunknownThe field’s value. This can be Blob or File. If none of these are specified the value is converted to a string.
fileName?stringThe filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is “blob”. The default filename for File objects is the file’s filename.

void