This recipe migrates usage of the legacyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nodejs/userland-migrations/llms.txt
Use this file to discover all available pages before exploring further.
buffer.atob() and buffer.btoa() APIs to the current recommended Buffer-based approaches for base64 encoding and decoding.
What It Does
The codemod transforms:buffer.atob(data)→Buffer.from(data, 'base64').toString('binary')buffer.btoa(data)→Buffer.from(data, 'binary').toString('base64')
Usage
Examples
Migrating buffer.atob()
Decoding base64-encoded data:Migrating buffer.btoa()
Encoding data to base64:Why Migrate?
Thebuffer.atob() and buffer.btoa() methods were convenience wrappers around Buffer operations. Using Buffer methods directly:
- Provides more explicit control over encoding
- Aligns with modern Node.js best practices
- Reduces dependency on the
buffermodule import - Offers better performance in some scenarios