UNPKG

postal-mime

Version:

Email parser for browser environments

18 lines (14 loc) 459 B
import { blobToArrayBuffer } from './decode-strings.js'; export default class PassThroughDecoder { constructor() { this.chunks = []; } update(line) { this.chunks.push(line); this.chunks.push('\n'); } finalize() { // convert an array of arraybuffers into a blob and then back into a single arraybuffer return blobToArrayBuffer(new Blob(this.chunks, { type: 'application/octet-stream' })); } }