Last updated 4 years ago
Was this helpful?
Download a file.
const {Api, TelegramClient} = require('telegram'); const {StringSession} = require('telegram/sessions'); const session = new StringSession(''); const client = new TelegramClient(session, apiId, apiHash, {}); (async function run() { const result = await client.invoke(new Api.upload.getCdnFile({ fileToken: Buffer.from('some bytes here'), offset: 1130267, limit: 8166765, })); console.log(result); // prints the result })();
import {Api, TelegramClient} from 'telegram'; import {StringSession} from 'telegram/sessions'; const session = new StringSession(''); const client = new TelegramClient(session, apiId, apiHash, {}); (async function run() { const result: Api.upload.CdnFile = await client.invoke(new Api.upload.getCdnFile({ fileToken: Buffer.from('some bytes here'), offset: 1130267, limit: 8166765, })); console.log(result); // prints the result })();
upload.cdnFileReuploadNeeded#eea8e46e request_token:bytes = upload.CdnFile; upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile; ---functions--- upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile;
Name
Type
Description
file_token
File token
offset
Offset of chunk to download
limit
Length of chunk to download
Code