🚑 Do not decode buffers to string

This commit is contained in:
C-3PO 2018-07-05 02:21:19 +02:00
parent e952f714df
commit 520f9c2e39
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
3 changed files with 0 additions and 3 deletions

View file

@ -9,7 +9,6 @@ export default function arrayBufferToStream(arrayBuffer: ArrayBuffer, offset = 0
let position = offset; let position = offset;
const outStream = new stream.Readable({ const outStream = new stream.Readable({
encoding: 'binary',
read(size) { read(size) {
const chunkSize = Math.min(size || BUFFER_SIZE, arrayBuffer.byteLength - position); //TODO: we can probably remove BUFFER_SIZE const chunkSize = Math.min(size || BUFFER_SIZE, arrayBuffer.byteLength - position); //TODO: we can probably remove BUFFER_SIZE
let needMoreData: boolean; let needMoreData: boolean;

View file

@ -5,7 +5,6 @@ export default function decryptStream(inputStream: stream.Readable, decryptionKe
let skippedRandomHeader = false; let skippedRandomHeader = false;
const outStream = new stream.Readable({ const outStream = new stream.Readable({
encoding: 'binary',
read(size) { read(size) {
//There are 12 random bytes at the beginning, we need to use them to initialize the decryption keys, but we can ignore the decrypted bytes. //There are 12 random bytes at the beginning, we need to use them to initialize the decryption keys, but we can ignore the decrypted bytes.
if (!skippedRandomHeader) { if (!skippedRandomHeader) {

View file

@ -9,7 +9,6 @@ export default function streamSetMaxLength(inputStream: stream.Readable, maxLeng
let remaining = maxLength; let remaining = maxLength;
const outStream = new stream.Readable({ const outStream = new stream.Readable({
encoding: 'binary',
read(size) { read(size) {
//If no size is provided, just pass through all remaining bytes //If no size is provided, just pass through all remaining bytes
if (size === undefined) { if (size === undefined) {