Uploading files
Using SendFile
SendFile
Uploading files can be tricky since GramJS needs to support both browsers and nodeJS.
You can use the sendFile
methods for most use cases
Using UploadFile
UploadFile
If you need more control over the upload process you can use uploadFile
which returns an InputFile that you can add attributes to and use in other methods such as changing profile picture.
when using uploadFile you'll need to specify the size and name yourself using the CustomFile
class
Increasing speed
If you want to upload at a faster rate GramJS provides an attribute called workers. by default, it's 1 which means a stable and slow upload. increasing this will improve upload speed but might make it unstable.
Note: Using anything above 15 is discouraged because telegram will disconnect you.
Last updated