docs: update base64 guide - #33040
Conversation
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/guides/util/base64.mdx`:
- Around line 27-35: Clarify the Buffer/Base64 docs so they don’t imply Buffer
has the same Uint8Array static API: the current example in the base64 guide
mixes Buffer.from(...).toBase64() with Buffer.from(encoded, "base64"), which can
confuse readers about fromBase64(). Update the surrounding text and example near
the base64 snippet to state that Buffer inherits toBase64() from Uint8Array, but
decoding here is using Buffer.from(..., "base64"), or alternatively show the
Uint8Array.fromBase64() path and then wrap the result in Buffer if that is the
intended guidance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 863c9669-d830-400d-96ad-54e2b253eee6
📒 Files selected for processing (2)
docs/guides/util/base64.mdxdocs/runtime/web-apis.mdx
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe base64 guide is rewritten to focus on ChangesBase64 docs update
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
yeah |
What does this PR do?
The guide for base64 show's outdated methods for handling the process.
I've updated the base64 guide to recommend
Uint8Array.prototype.toBase64()andUint8Array.fromBase64()for encoding and decoding base64 data.These APIs operate on bytes directly, which makes them a better default than
btoa()andatob()for binary data and for strings once converted throughTextEncoder/TextDecoder. The guide now includes examples for byte arrays, UTF-8 strings, andBuffer, and keepsbtoa()/atob()documented as legacy compatibility APIs.Also updates the Web APIs reference to list
Uint8Arraybase64 helpers alongside the related encoding and decoding APIs.How did you verify your code works?
No source code has been modified.