Unable to use downloadFile
I am using TDL which is a javascript wrapper for TDLib. Following is my code to download a file. When I run this code I get updateFile logged twice in the console. The first time it says "is_downloading_active": true and "is_downloading_completed": false. The second time it says "is_downloading_active": false, "is_downloading_completed": false, "downloaded_size": 0. Why didn't file got downloaded. I can clearly see the file which is an image in my telegram app so definitely file is there.
client.on('update', onUpdate);
async function main () {
await client.login()
const chat = await client.invoke({
_: 'getChat',
chat_id: -702279442
})
let fileID = chat.last_message.content.photo.sizes[2].photo.id;
const download = await client.invoke({
_: 'downloadFile',
file_id: fileID,
priority: 32
});
await client.close()
}
function onUpdate(upd){
if (upd['_'] === 'updateFile'){
console.log(upd);
}
}
main().catch(console.error)
client.on('update', onUpdate);
async function main () { await client.login()
const chat = await client.invoke({
_: 'getChat',
chat_id: -702279442
})
let fileID = chat.last_message.content.photo.sizes[2].photo.id;
const download = await client.invoke({
_: 'downloadFile',
file_id: fileID,
priority: 32
});
await client.close()
}
function onUpdate(upd){ if (upd['_'] === 'updateFile'){ console.log(upd); } }
main().catch(console.error)
Check TDLib logs with verbosity level 2.