From 7dfe0176ab9de6c4b63a4f888d42219d2f7a09c8 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Thu, 5 Jul 2018 13:24:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Do=20not=20reuse=20TextDecoder?= =?UTF-8?q?=20for=20multiple=20stream=20decodes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/streams/streamToString.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ssn/streams/streamToString.ts b/src/ssn/streams/streamToString.ts index 3917170..97cf953 100644 --- a/src/ssn/streams/streamToString.ts +++ b/src/ssn/streams/streamToString.ts @@ -1,9 +1,9 @@ import * as stream from 'stream'; import { TextDecoder } from 'util'; -const decoder = new TextDecoder('utf-8'); - export default function streamToString(inputStream: stream.Readable): Promise { + const decoder = new TextDecoder('utf-8'); + return new Promise((resolve, reject) => { const stringParts: string[] = [];