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

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

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gramjs/client/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Loading