INNER CODE UNIT · TypeScript

units

postalsys/postal-mime · src/base64-decoder.ts:42

        const units = str.split(/=+/);
        for (let i = 0; i < units.length; i++) {
            this.remainder += units[i];
            // the trailing piece is not followed by padding, so it stays open
            if (i < units.length - 1) {
                this.flushRemainder();
            }
        }

        if (this.remainder.length >= this.maxChunkSize) {
            const alignedLength = Math.floor(this.remainder.length / 4) * 4;
            this.pushChunk(this.remainder.substring(0, alignedLength));
            this.remainder = this.remainder.substring(alignedLength);
        }
    }

    finalize(): Promise<ArrayBuffer> {
        this.flushRemainder();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…