Class: FormData

bot-utils~FormData() → {FormData}

new FormData() → {FormData}

A simple FormData implemention, does not support mixed files because Telegram Bot API does not use it. It is designed for upload files, so don't think you can get your value as original type.

Source:
Returns:
Type
FormData
Example
new FormData()

Methods

append(name, value, filenameopt)

Parameters:
Name Type Attributes Default Description
name String
value String | Buffer
filename String <optional>
null

If you want to upload a file, Telegram Bot API needs this.

Source:
See:

delete(name)

Parameters:
Name Type Description
name String
Source:
See:

(generator) entries() → {Iterator.<String, (String|Buffer)>}

Source:
See:
Returns:
Type
Iterator.<String, (String|Buffer)>

get(name) → {String|Buffer}

Parameters:
Name Type Description
name String
Source:
See:
Returns:

Value

Type
String | Buffer

getAll(name) → {Array}

Parameters:
Name Type Description
name String
Source:
See:
Returns:

Array of value.

Type
Array

getBuffer() → {Buffer}

Get a buffer that can be written to http requests.

Source:
Returns:
Type
Buffer

getHeaders() → {Buffer}

Get headers for buffer that can be past to http requests, you'd better call getBuffer() first.

Source:
Returns:
Type
Buffer

getLength() → {Number}

Get buffer length, you'd better call getBuffer() first.

Source:
Returns:
Type
Number

has(name) → {Boolean}

Parameters:
Name Type Description
name String
Source:
See:
Returns:
Type
Boolean

(generator) keys() → {Iterator.<String>}

Source:
See:
Returns:
Type
Iterator.<String>

set(name, value, filenameopt)

Parameters:
Name Type Attributes Default Description
name String
value String | Buffer
filename String <optional>
null

If you want to upload a file, Telegram Bot API needs this.

Source:
See:

(generator) values() → {Iterator.<(String|Buffer)>}

Source:
See:
Returns:
Type
Iterator.<(String|Buffer)>