What This Adds In Cloud Code
- Stable base64 decode helper from the Cloud runtime.
- Safe fallback behavior for malformed payloads.
- Handy for decoding webhook fields or encoded IDs.
Quick Start
js
const atob = require('atob');
const decoded = atob(request.params.payload || '');API
| Function | Params | Returns | Notes |
|---|---|---|---|
atob(data) | data: string | string | Callable default export. Returns decoded string; returns empty string if decode fails. |
Practical Example
js
const atob = require('atob');
const csvContent = atob(request.params.csv_base64);
const rows = csvContent.split('\n');Failure Modes & Gotchas
- Invalid base64 returns
''instead of throwing. - Module is callable directly (
atob(data)), no.decodewrapper needed. - Always validate decoded content before parsing.