MCPcopy Create free account
hub / github.com/QLHazyCoder/FlowPilot / base64ToBytes

Function base64ToBytes

cloudflare-temp-email-utils.js:168–186  ·  view source on GitHub ↗
(value = '')

Source from the content-addressed store, hash-verified

166 }
167
168 function base64ToBytes(value = '') {
169 const normalized = String(value || '').replace(/\s+/g, '');
170 if (!normalized) return new Uint8Array();
171
172 if (typeof atob === 'function') {
173 const decoded = atob(normalized);
174 const bytes = new Uint8Array(decoded.length);
175 for (let i = 0; i < decoded.length; i += 1) {
176 bytes[i] = decoded.charCodeAt(i);
177 }
178 return bytes;
179 }
180
181 if (typeof Buffer !== 'undefined') {
182 return Uint8Array.from(Buffer.from(normalized, 'base64'));
183 }
184
185 throw new Error('No base64 decoder available');
186 }
187
188 function quotedPrintableToBytes(value = '', options = {}) {
189 const { headerMode = false } = options;

Callers 2

decodeMimeEncodedWordsFunction · 0.85
decodeMimeBodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected