From 975eecd0d05df699fa59cb3777c86f3512eec4f1 Mon Sep 17 00:00:00 2001 From: Jonas Eckstein Date: Mon, 31 Jan 2022 18:11:46 +0100 Subject: [PATCH] Fix binary data as input in byte mode --- lib/core/byte-data.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/byte-data.js b/lib/core/byte-data.js index 778181c9..289a601f 100644 --- a/lib/core/byte-data.js +++ b/lib/core/byte-data.js @@ -3,7 +3,10 @@ const Mode = require('./mode') function ByteData (data) { this.mode = Mode.BYTE - this.data = new Uint8Array(encodeUtf8(data)) + if (typeof (data) === 'string') { + data = encodeUtf8(data) + } + this.data = new Uint8Array(data) } ByteData.getBitsLength = function getBitsLength (length) {