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

Function quotedPrintableToBytes

cloudflare-temp-email-utils.js:188–205  ·  view source on GitHub ↗
(value = '', options = {})

Source from the content-addressed store, hash-verified

186 }
187
188 function quotedPrintableToBytes(value = '', options = {}) {
189 const { headerMode = false } = options;
190 const source = String(value || '')
191 .replace(/=\r?\n/g, '')
192 .replace(headerMode ? /_/g : /$^/, ' ');
193
194 const bytes = [];
195 for (let index = 0; index < source.length; index += 1) {
196 const char = source[index];
197 if (char === '=' && /^[0-9A-Fa-f]{2}$/.test(source.slice(index + 1, index + 3))) {
198 bytes.push(parseInt(source.slice(index + 1, index + 3), 16));
199 index += 2;
200 continue;
201 }
202 bytes.push(char.charCodeAt(0));
203 }
204 return Uint8Array.from(bytes);
205 }
206
207 function decodeBytesToString(bytes, charset = 'utf-8') {
208 const normalizedCharset = String(charset || 'utf-8').trim().toLowerCase();

Callers 2

decodeMimeEncodedWordsFunction · 0.85
decodeMimeBodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected