Skip to content

Commit

Permalink
Use Buffer.from instead of deprecated new Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Dec 12, 2021
1 parent 6eb008d commit b6aed68
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions KaitaiStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ KaitaiStream.bytesToStr = function(arr, encoding) {
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return new Buffer(arr).toString(encoding);
break;
return Buffer.from(arr).toString(encoding);
default:
// unsupported encoding, we'll have to resort to iconv-lite
if (typeof KaitaiStream.iconvlite === 'undefined')
Expand Down

0 comments on commit b6aed68

Please sign in to comment.