Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with >2gb files - no download in firefox download manager or progress bar #99

Open
Lowadara opened this issue Jan 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Lowadara
Copy link

Lowadara commented Jan 10, 2025

Describe the issue
I cant download files bigger than 2gb
After starting a download, no download appears in the firefox download manager, no download bar appears.

To reproduce
Steps to reproduce the behavior:

  1. Go to /k/ Telegram Webapp
  2. Click on video
  3. click on download symbol
  4. network traffic picks up
  5. after 2gb, the script stops

Expected behavior
I was expecting the download manager to download the file
This morning it worked for w while and I could download files bigger than 2gb as firefox did the downloading

Environment:

  • Browser: FireFox 134
  • Tampermonkey 5.3.3
  • Script Version: 1.203

Additional context
[2654.002] [API] Request is still processing: upload.getFile
Object { location: {…}, offset: 2671575040, limit: 65536 }

Object { dcId: 4, fileDownload: true, floodMaxTimeout: undefined, resultType: "upload.File", messageId: "7458275005571744692" }
time: 10.025 mtproto.worker-P52RgNUJ.js:1:5158
[2654.002] [API] Request is still processing: upload.getFile
Object { location: {…}, offset: 2671575040, limit: 65536 }

Object { dcId: 4, fileDownload: true, floodMaxTimeout: undefined, resultType: "upload.File", messageId: "7458275005571744692" }
time: 10.025 mtproto.worker-P52RgNUJ.js:1:5158
[2655.679] [IDB-tweb] abort: [object Event] 2 mtproto.worker-P52RgNUJ.js:1:5158
[AS]: set error: QuotaExceededError: The current transaction exceeded its quota limitations.
Array [ "2049184922" ]

Array [ {…} ]
mtproto.worker-P52RgNUJ.js:1:17258
[AS]: set error: QuotaExceededError: The current transaction exceeded its quota limitations.
Array [ "2049184922" ]

Array [ {…} ]
mtproto.worker-P52RgNUJ.js:1:17258
[2659.148] [MP-MTPROTO] worker task error: TypeError: Blob constructor: ArrayBufferView branch of ((ArrayBufferView or ArrayBuffer) or Blob or USVString) can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB
Bi https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14
finalize https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14
ze https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14
ze https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14

Object { type: "invoke", payload: {…}, id: 6215, transfer: undefined }
mtproto.worker-P52RgNUJ.js:1:5158
[2659.148] [MP-MTPROTO] worker task error: TypeError: Blob constructor: ArrayBufferView branch of ((ArrayBufferView or ArrayBuffer) or Blob or USVString) can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB
Bi https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14
finalize https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14
ze https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14
ze https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:14

Object { type: "invoke", payload: {…}, id: 6215, transfer: undefined }
mtproto.worker-P52RgNUJ.js:1:5158
p https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:1
processInvokeTask https://web.telegram.org/k/mtproto.worker-P52RgNUJ.js:1

....



Reason for the back and forth:
I got confused as it didnt work, then, my firefox crashed, after a restart of firefox it worked. Now it doesnt anymore.
Later, firefox crashed again, now it works ...


Thank you!
@Lowadara Lowadara added the bug Something isn't working label Jan 10, 2025
@Lowadara Lowadara changed the title Download starts on K, but no file is saved Download starts on K, but no file is saved (>2gb issue?) Jan 10, 2025
@Lowadara Lowadara changed the title Download starts on K, but no file is saved (>2gb issue?) my mistake, cant find how to delete the reported bug Jan 10, 2025
@Lowadara Lowadara changed the title my mistake, cant find how to delete the reported bug Problem with >2gb files - no download in firefox download manager or progress bar Jan 10, 2025
@Neet-Nestor
Copy link
Owner

Neet-Nestor commented Feb 23, 2025

According to Gemini:

This error message "TypeError: Blob constructor: ArrayBufferView branch of ((ArrayBufferView or ArrayBuffer) or Blob or USVString) can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB" means you're trying to create a Blob object in JavaScript using an ArrayBuffer or ArrayBufferView that is larger than 2 gigabytes, which is the current limit for such operations in most browsers. 
Explanation:
Blob and ArrayBuffer:
A Blob (Binary Large Object) is a data object that represents raw binary data in JavaScript, and an ArrayBuffer is a raw binary data buffer that can be accessed using TypedArrays. 
Size limitation:
When creating a Blob from an ArrayBuffer or ArrayBufferView, the browser usually enforces a maximum size of 2GB. 
What causes this error:
Large file upload:
Trying to upload a file larger than 2GB directly as a Blob using an ArrayBuffer. 
Large data manipulation:
Attempting to create a Blob from a large in-memory ArrayBuffer that exceeds the 2GB limit. 
How to fix:
Chunk the data:
If you need to handle files larger than 2GB, split the data into smaller chunks and create separate Blobs for each chunk. 
Use a streaming approach:
Instead of loading the entire file into memory as an ArrayBuffer, consider using a File Reader to read the data in chunks as a stream and create the Blob progressively. 
Check browser compatibility:
While the 2GB limit is common, be aware that different browsers may have slightly different constraints. 

Seems like large file sizes requires chunking and file system management, which is currently missing in the script functionality.

Unfortunately I'm pretty busy recently so I will keep this open for a while and look forward to someone else adding this handling later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants