index.js
function strbuf(str) {
  var b = new ByteBuffer(str.length + 4);

  b.setUint16 (0, str.length, true);

  for (var i = 0; i < str.length; i += 2) {
    b.setUint16 (i + 2, str.getUint16 (i), true);
  }

  b.setUint16 (b.length - 2, 0, true);

  return b;
}
function strbuf(str) {
  var b = new ByteBuffer(str.length + 4);

  b.setUint16 (0, str.length, true);

  for (var i = 0; i < str.length; i += 2) {
    b.setUint16 (i + 2, str.getUint16 (i), true);
  }

  b.setUint16 (b.length - 2, 0, true);

  return b;
}
function strbuf ( str ) { var b = new ByteBuffer ( str . length + 4 ) ; b . setUint16 ( 0 , str . length , true ) ; for ( var i = 0 ; i < str . length ; i += 2 ) { b . setUint16 ( i + 2 , str . getUint16 ( i ) , true ) ; } b . setUint16 ( b . length - 2 , 0 , true ) ; return b ; }
Utility function to convert buffer of utf16be chars to buffer of utf16le
chars prefixed with length and suffixed with zero
Utility function to convert buffer of utf16be chars to buffer of utf16le chars prefixed with length and suffixed with zero