From 520f9c2e397c43f16ab48504e1f091ce031161fc Mon Sep 17 00:00:00 2001 From: C-3PO Date: Thu, 5 Jul 2018 02:21:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Do=20not=20decode=20buffers=20to?= =?UTF-8?q?=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/streams/arrayBufferToStream.ts | 1 - src/ssn/streams/decryptStream.ts | 1 - src/ssn/streams/streamSetMaxLength.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/src/ssn/streams/arrayBufferToStream.ts b/src/ssn/streams/arrayBufferToStream.ts index 291ddb3..e961ebd 100644 --- a/src/ssn/streams/arrayBufferToStream.ts +++ b/src/ssn/streams/arrayBufferToStream.ts @@ -9,7 +9,6 @@ export default function arrayBufferToStream(arrayBuffer: ArrayBuffer, offset = 0 let position = offset; const outStream = new stream.Readable({ - encoding: 'binary', read(size) { const chunkSize = Math.min(size || BUFFER_SIZE, arrayBuffer.byteLength - position); //TODO: we can probably remove BUFFER_SIZE let needMoreData: boolean; diff --git a/src/ssn/streams/decryptStream.ts b/src/ssn/streams/decryptStream.ts index a805e66..3470719 100644 --- a/src/ssn/streams/decryptStream.ts +++ b/src/ssn/streams/decryptStream.ts @@ -5,7 +5,6 @@ export default function decryptStream(inputStream: stream.Readable, decryptionKe let skippedRandomHeader = false; const outStream = new stream.Readable({ - encoding: 'binary', 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. if (!skippedRandomHeader) { diff --git a/src/ssn/streams/streamSetMaxLength.ts b/src/ssn/streams/streamSetMaxLength.ts index 499caef..3b8eb69 100644 --- a/src/ssn/streams/streamSetMaxLength.ts +++ b/src/ssn/streams/streamSetMaxLength.ts @@ -9,7 +9,6 @@ export default function streamSetMaxLength(inputStream: stream.Readable, maxLeng let remaining = maxLength; const outStream = new stream.Readable({ - encoding: 'binary', read(size) { //If no size is provided, just pass through all remaining bytes if (size === undefined) {