Form-data API
chevron down
 

Form-data API

Class: FormData

The FormData class provides an easy way to construct a multipart/form-data request.

The Fitbit implementation of this only supports string, not Blob or File types.

Methods

append()

append(name: string, value: string, fileName?: string | undefined)

Returns: void

Append a new value onto an existing key, adding it if it does not exist.

delete()

delete(name: string)

Returns: void

Deletes a key/value pair if it exists.

entries()

Returns: IterableIterator<string, string>

Returns an iterator over all key value pairs.

get()

get(name: string)

Returns: string or null

Gets a value by name, returning the first matching value with this name, and returning null if it does not exist.

getAll()

getAll(name: string)

Returns: string[]

Gets values by name, returning an array of values matching this name.

has()

has(name: string)

Returns: boolean

Returns true if a key exists with this name, false otherwise.

keys()

Returns: IterableIterator<string>

Returns an iterator over all keys.

set()

set(name: string, value: string)

Returns: void

Sets a value given a name and value, replacing any existing value with the same name if one exists.

values()

Returns: IterableIterator<string>

Returns an iterator over all form values.

FormDataEntryValue

String: string