浏览代码

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

Anwin Sharon 9 月之前
父节点
当前提交
6ec4e4b715
共有 1 个文件被更改,包括 2 次插入1 次删除
  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 UPLOAD_TIMEOUT = 15 * 1000;
 const DISCONNECT_SLEEP = 1000;
 const DISCONNECT_SLEEP = 1000;
 const BUFFER_SIZE_2GB = 2 ** 31;
 const BUFFER_SIZE_2GB = 2 ** 31;
+const BUFFER_SIZE_20MB = 20 * 1024 * 1024;
 
 
 async function getFileBuffer(
 async function getFileBuffer(
     file: File | CustomFile,
     file: File | CustomFile,
@@ -128,7 +129,7 @@ export async function uploadFile(
     const buffer = await getFileBuffer(
     const buffer = await getFileBuffer(
         file,
         file,
         size,
         size,
-        fileParams.maxBufferSize || BUFFER_SIZE_2GB - 1
+        fileParams.maxBufferSize || BUFFER_SIZE_20MB - 1
     );
     );
 
 
     // Make sure a new sender can be created before starting upload
     // Make sure a new sender can be created before starting upload