lib/buffer-util.js
function viewToBuffer(view) {
  const buf = Buffer.from(view.buffer);

  if (view.byteLength !== view.buffer.byteLength) {
    return buf.slice(view.byteOffset, view.byteOffset + view.byteLength);
  }

  return buf;
}
function viewToBuffer(view) {
  const buf = Buffer.from(view.buffer);

  if (view.byteLength !== view.buffer.byteLength) {
    return buf.slice(view.byteOffset, view.byteOffset + view.byteLength);
  }

  return buf;
}
function viewToBuffer ( view ) { const buf = Buffer . from ( view . buffer ) ; if ( view . byteLength !== view . buffer . byteLength ) { return buf . slice ( view . byteOffset , view . byteOffset + view . byteLength ) ; } return buf ; }
Converts an `ArrayBuffer` view into a buffer.

@param {(DataView|TypedArray)} view The view to convert
@return {Buffer} Converted view
@private
Converts an ArrayBuffer view into a buffer .