(value)
| 965 | |
| 966 | // Split Base64 to lines with 68 characters |
| 967 | function prepareBASE64(value) { |
| 968 | |
| 969 | var index = 0; |
| 970 | var output = ''; |
| 971 | var length = value.length; |
| 972 | |
| 973 | while (index < length) { |
| 974 | var max = index + 68; |
| 975 | if (max > length) |
| 976 | max = length; |
| 977 | output += value.substring(index, max) + CRLF; |
| 978 | index = max; |
| 979 | } |
| 980 | |
| 981 | return output; |
| 982 | } |
| 983 | |
| 984 | function unicode_encode(val) { |
| 985 | return val ? '=?utf-8?B?' + Buffer.from(val.toString()).toString('base64') + '?=' : ''; |