Skip to content

Commit

Permalink
Fix binary data as input in byte mode
Browse files Browse the repository at this point in the history
  • Loading branch information
RenovatingDev committed Jan 31, 2022
1 parent 557e0d8 commit 975eecd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/core/byte-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 975eecd

Please sign in to comment.