Browse Source

chore: Update max buffer size for file uploads to 20MB (#701)

Anwin Sharon 9 months ago
parent
commit
6ec4e4b715
1 changed files with 2 additions and 1 deletions
  1. 2 1
      gramjs/client/uploads.ts

+ 2 - 1
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