(raw, encoding)
| 17 | * @return {Object<message, attachments>} parsed content separated in message and attachments |
| 18 | */ |
| 19 | export function parseMessage(raw, encoding) { |
| 20 | // ASCII header bytes are identical under the binary-string / Unicode-string interpretations, |
| 21 | // so this header-detection regex works directly on the raw binary string. |
| 22 | if (/^\s*(MIME-Version|Content-Type|Content-Class|Content-Transfer-Encoding|Content-ID|Content-Description|Content-Disposition|Content-Language|From|Date):/.test(raw)) { |
| 23 | return parseMIME(raw, encoding); |
| 24 | } else { |
| 25 | return parseInline(raw, encoding); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | async function parseMIME(raw, encoding) { |
| 30 | let message = ''; |
no test coverage detected