index.js
function buffer2ArrayBuffer(buffer) {
  var buf = new ArrayBuffer(buffer.length);
  var bufView = new Uint8Array(buf);
  for (var i = 0; i < buffer.length; i++) {
    bufView[i] = buffer[i];
  }
  return buf;
}
function buffer2ArrayBuffer(buffer) {
  var buf = new ArrayBuffer(buffer.length);
  var bufView = new Uint8Array(buf);
  for (var i = 0; i < buffer.length; i++) {
    bufView[i] = buffer[i];
  }
  return buf;
}
function buffer2ArrayBuffer ( buffer ) { var buf = new ArrayBuffer ( buffer . length ) ; var bufView = new Uint8Array ( buf ) ; for ( var i = 0 ; i < buffer . length ; i ++ ) { bufView [ i ] = buffer [ i ] ; } return buf ; }
Convert buffer to ArrayBuffer
Convert buffer to ArrayBuffer