2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-31 06:16:07 +00:00

src/telegram: Add TelegramBot#getFileStream()

References:

  * FR: https://github.com/yagop/node-telegram-bot-api/issues/442
This commit is contained in:
GochoMugo
2017-12-07 12:04:46 +03:00
parent 0870684d83
commit d9692f45a9
5 changed files with 64 additions and 4 deletions

View File

@@ -61,6 +61,7 @@ TelegramBot
* [.sendContact(chatId, phoneNumber, firstName, [options])](#TelegramBot+sendContact) ⇒ <code>Promise</code>
* [.getFile(fileId, [options])](#TelegramBot+getFile) ⇒ <code>Promise</code>
* [.getFileLink(fileId, [options])](#TelegramBot+getFileLink) ⇒ <code>Promise</code>
* [.getFileStream(fileId, [options])](#TelegramBot+getFileStream) ⇒ <code>stream.Readable</code>
* [.downloadFile(fileId, downloadDir, [options])](#TelegramBot+downloadFile) ⇒ <code>Promise</code>
* [.onText(regexp, callback)](#TelegramBot+onText)
* [.removeTextListener(regexp)](#TelegramBot+removeTextListener) ⇒ <code>Object</code>
@@ -841,6 +842,22 @@ which returns just path to file on remote server (you will have to manually buil
| fileId | <code>String</code> | File identifier to get info about |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+getFileStream"></a>
### telegramBot.getFileStream(fileId, [options]) ⇒ <code>stream.Readable</code>
Return a readable stream for file.
This method is a sugar extension of the [getFileLink](#TelegramBot+getFileLink) method,
which returns the full URI to the file on remote server.
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
**Returns**: <code>stream.Readable</code> - stream
| Param | Type | Description |
| --- | --- | --- |
| fileId | <code>String</code> | File identifier to get info about |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+downloadFile"></a>
### telegramBot.downloadFile(fileId, downloadDir, [options]) ⇒ <code>Promise</code>