From 6ec4e4b715f1a751039ea42b38914f0e9716d1f5 Mon Sep 17 00:00:00 2001 From: Anwin Sharon <87226858+darkdeathoriginal@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:18:45 +0530 Subject: [PATCH] chore: Update max buffer size for file uploads to 20MB (#701) --- gramjs/client/uploads.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gramjs/client/uploads.ts b/gramjs/client/uploads.ts index df98d055..89983b31 100644 --- a/gramjs/client/uploads.ts +++ b/gramjs/client/uploads.ts @@ -95,6 +95,7 @@ const LARGE_FILE_THRESHOLD = 10 * 1024 * 1024; const UPLOAD_TIMEOUT = 15 * 1000; const DISCONNECT_SLEEP = 1000; const BUFFER_SIZE_2GB = 2 ** 31; +const BUFFER_SIZE_20MB = 20 * 1024 * 1024; async function getFileBuffer( file: File | CustomFile, @@ -128,7 +129,7 @@ export async function uploadFile( const buffer = await getFileBuffer( file, size, - fileParams.maxBufferSize || BUFFER_SIZE_2GB - 1 + fileParams.maxBufferSize || BUFFER_SIZE_20MB - 1 ); // Make sure a new sender can be created before starting upload