Fix binary data as input in byte mode

This commit is contained in:
Jonas Eckstein 2022-01-31 18:11:46 +01:00
parent 557e0d80f7
commit 975eecd0d0

View file

@ -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) {