GramIO API Reference / @gramio/files/dist
@gramio/files/dist
Classes
| Class | Description |
|---|---|
| MediaInput | Class-helper with static methods that represents the content of a media message to be sent. |
| MediaUpload | Class-helper with static methods for file uploading. |
Variables
MEDIA_METHODS
constMEDIA_METHODS:MethodsWithMediaUpload
Defined in: files/index.d.ts:41
A set of methods with the function of checking whether a File has been passed in the parameters
Codegenerated
Functions
convertJsonToFormData()
convertJsonToFormData<
T>(method,params):Promise<FormData>
Defined in: files/index.d.ts:12
Helper to convert JSON to FormData that can accept Telegram Bot API. if File is not top-level property it will be “attach://<file_attach_name>”
Type Parameters
| Type Parameter |
|---|
T extends keyof APIMethods |
Parameters
| Parameter | Type |
|---|---|
method | T |
params | NonNullable<APIMethodParams<T>> |
Returns
Promise<FormData>
convertStreamToBuffer()
convertStreamToBuffer(
stream):Promise<Buffer<ArrayBufferLike>>
Defined in: files/index.d.ts:21
Helper for convert Readable stream to buffer
Parameters
| Parameter | Type |
|---|---|
stream | Readable |
Returns
Promise<Buffer<ArrayBufferLike>>
extractFilesToFormData()
extractFilesToFormData<
T>(method,params):Promise<[FormData,NonNullable<APIMethodParams<T>>]>
Defined in: files/index.d.ts:19
Helper to extract files from params and convert them to FormData. (Similar to convertJsonToFormData) if File is not top-level property it will be “attach://<file_attach_name>”
Type Parameters
| Type Parameter |
|---|
T extends keyof APIMethods |
Parameters
| Parameter | Type |
|---|---|
method | T |
params | NonNullable<APIMethodParams<T>> |
Returns
Promise<[FormData, NonNullable<APIMethodParams<T>>]>
isBlob()
isBlob(
blob?):boolean
Defined in: files/index.d.ts:35
Guard to check is it Blob or Promise
Parameters
| Parameter | Type |
|---|---|
blob? | string | object | Blob |
Returns
boolean
isMediaUpload()
isMediaUpload<
T>(method,params):boolean
Defined in: files/index.d.ts:5
Guard to check is method used for File Uploading
Type Parameters
| Type Parameter |
|---|
T extends keyof APIMethods |
Parameters
| Parameter | Type |
|---|---|
method | T |
params | NonNullable<APIMethodParams<T>> |
Returns
boolean