'pyrogram : method that returns file size and possibly file type
is there any method/s to return the size of the file [anything doc, audio, video] and file type? (specifically in pyrogram not python itself) file type part isn't necessary but I desperately looking to get file size
Solution 1:[1]
I haven't used python in a while but I think you can use the os module for this.
import os
size = os.path.getsize('path/to/file')
print(size)
Solution 2:[2]
bro for photo size you can do like https://docs.pyrogram.org/telegram/base/photo-size?highlight=size#pyrogram.raw.base.PhotoSize, and for get video size https://docs.pyrogram.org/telegram/base/video-size?highlight=size#pyrogram.raw.base.VideoSize, Take these objects and then print and show you their actual size, And to get the size of other elements as a document, you can use this https://docs.pyrogram.org/telegram/types/document?highlight=size and then print it
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Setvizan |
| Solution 2 | Matin |
