(value = '')
| 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; |
no outgoing calls
no test coverage detected