/opt/canhelp/node_modules/postal-mime/src
NameSizeModeActions
address-parser.js129290644editdlrm
base64-decoder.js13300644editdlrm
base64-encoder.js32560644editdlrm
decode-strings.js90930644editdlrm
html-entities.js605550644editdlrm
mime-node.js122490644editdlrm
package.json250644editdlrm
pass-through-decoder.js4590644editdlrm
postal-mime.js208870644editdlrm
qp-decoder.js39360644editdlrm
text-format.js102520644editdlrm
Edit: /opt/canhelp/node_modules/postal-mime/src/base64-decoder.js (1330B)
import { decodeBase64, blobToArrayBuffer } from './decode-strings.js'; export default class Base64Decoder { constructor(opts) { opts = opts || {}; this.decoder = opts.decoder || new TextDecoder(); this.maxChunkSize = 100 * 1024; this.chunks = []; this.remainder = ''; } update(buffer) { let str = this.decoder.decode(buffer); str = str.replace(/[^a-zA-Z0-9+\/]+/g, ''); this.remainder += str; if (this.remainder.length >= this.maxChunkSize) { let allowedBytes = Math.floor(this.remainder.length / 4) * 4; let base64Str; if (allowedBytes === this.remainder.length) { base64Str = this.remainder; this.remainder = ''; } else { base64Str = this.remainder.substr(0, allowedBytes); this.remainder = this.remainder.substr(allowedBytes); } if (base64Str.length) { this.chunks.push(decodeBase64(base64Str)); } } } finalize() { if (this.remainder && !/^=+$/.test(this.remainder)) { this.chunks.push(decodeBase64(this.remainder)); } return blobToArrayBuffer(new Blob(this.chunks, { type: 'application/octet-stream' })); } }