|
|
|
|
@ -117,16 +117,16 @@ bot.sendPhoto(chatId, url); |
|
|
|
|
|
|
|
|
|
If you wish to explicitly specify the filename or |
|
|
|
|
[MIME type](http://en.wikipedia.org/wiki/Internet_media_type), |
|
|
|
|
you may pass the an additional argument as file options, like so: |
|
|
|
|
you may pass an additional argument as file options, like so: |
|
|
|
|
|
|
|
|
|
```js |
|
|
|
|
const fileOpts = { |
|
|
|
|
const fileOptions = { |
|
|
|
|
// Explicitly specify the file name. |
|
|
|
|
filename: 'customfilename', |
|
|
|
|
// Explicitly specify the MIME type. |
|
|
|
|
contentType: 'audio/mpeg' |
|
|
|
|
contentType: 'audio/mpeg', |
|
|
|
|
}; |
|
|
|
|
bot.sendAudio(chatId, data, {}, fileOpts); |
|
|
|
|
bot.sendAudio(chatId, data, {}, fileOptions); |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
<a name="sending-files-options"></a> |
|
|
|
|
@ -140,6 +140,10 @@ variable `NTBA_FIX_350`.** |
|
|
|
|
In order of highest-to-lowest precedence in searching for |
|
|
|
|
a value, when resolving the `filename`: |
|
|
|
|
|
|
|
|
|
*(`fileOptions` is the Object argument passed to the method. |
|
|
|
|
The "file" argument passed to the method can be a `Stream`, |
|
|
|
|
`Buffer` or `filepath`.)* |
|
|
|
|
|
|
|
|
|
1. Is `fileOptions.filename` explictly defined? |
|
|
|
|
1. Does `Stream#path` exist? |
|
|
|
|
1. Is `filepath` provided? |
|
|
|
|
@ -152,7 +156,7 @@ And the `contentType`: |
|
|
|
|
1. Try detecting file-type from the `Buffer` |
|
|
|
|
1. Is `filepath` provided? |
|
|
|
|
1. Is `fileOptions.filename` explicitly defined? |
|
|
|
|
1. Default to `"application/octet-stream` |
|
|
|
|
1. Default to `"application/octet-stream"` |
|
|
|
|
|
|
|
|
|
<a name="sending-files-performance"></a> |
|
|
|
|
### Performance Issue |
|
|
|
|
|