-
Notifications
You must be signed in to change notification settings - Fork 342
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
Proposal: response.base64() #1800
Comments
I think now it'd be |
Having |
Yes, was following proposal-arraybuffer-base64 but again we would still need to do a |
|
@annevk |
No, it gives you a view (of type |
oh! in that case yeah it seems short enough :-) |
Ah! Okies.
+1 |
What problem are you trying to solve?
Problem Statement
Currently, when working with the Fetch API, converting response data to base64 encoding requires multiple steps and introduces complexity, especially when handling binary data. Developers often need to:
This process is error-prone and requires additional code that could be standardized.
What solutions exist today?
Existing Solutions
Currently, developers typically handle this in one of these ways:
Both approaches have drawbacks:
How would you solve it?
Proposed Solution
Add a new method
base64()
to the Response prototype:Example usage:
Implementation Details
The method would:
Benefits
Compatibility
The method name
base64()
is not currently used in the Response prototype, making it safe to add. The method would return a Promise to maintain consistency with other Response body reading methods.Additional Considerations
Security
Edge Cases
Performance Impact
Anything else?
Open Questions
The text was updated successfully, but these errors were encountered: