function cloneBuffer(buffer, isDeep) {
  if (isDeep) {
    return buffer.slice();
  }
  var length = buffer.length,
      result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);

  buffer.copy(result);
  return result;
}
Creates a clone of  `buffer`.

@private
@param {Buffer} buffer The buffer to clone.
@param {boolean} [isDeep] Specify a deep clone.
@returns {Buffer} Returns the cloned buffer.