Skip to content

toBase64 stack overflow on large inputs (e.g. image uploads) in non-Node environments #932

@Emeenent14

Description

@Emeenent14

Summary

The toBase64 utility in src/internal/utils/base64.ts crashes with a "Maximum call stack size exceeded" error when processing inputs larger than ~100KB in environments without Node.js Buffer (standard browsers, Cloudflare Workers, etc.).

Reproduction

In a browser or worker:

const large = new Uint8Array(200 * 1024);
toBase64(large); // Crashes with RangeError: Maximum call stack size exceeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions