build/lib/buffer-utils.js
function toBuffer(buf) {
  if (buf instanceof ArrayBuffer) {
    return arrayBufferToBuffer(buf);
  } else if (Buffer.isBuffer(buf)) {
    return buf;
  } else if (buf instanceof Uint8Array) {
    return new Buffer(buf);
  } else {
    return buf; // type unknown, trust the user
  }
}
function toBuffer(buf) {
  if (buf instanceof ArrayBuffer) {
    return arrayBufferToBuffer(buf);
  } else if (Buffer.isBuffer(buf)) {
    return buf;
  } else if (buf instanceof Uint8Array) {
    return new Buffer(buf);
  } else {
    return buf; // type unknown, trust the user
  }
}
function toBuffer ( buf ) { if ( buf instanceof ArrayBuffer ) { return arrayBufferToBuffer ( buf ) ; } else if ( Buffer . isBuffer ( buf ) ) { return buf ; } else if ( buf instanceof Uint8Array ) { return new Buffer ( buf ) ; } else { return buf ; // type unknown, trust the user } }
Converts the buffer to Buffer
@param {Buffer|ArrayBuffer|Uint8Array} buf Input buffer
@returns {Buffer}
Converts the buffer to Buffer