How to use the prototype function from safe-buffer

Find comprehensive JavaScript safe-buffer.prototype code examples handpicked from public code repositorys.

751
752
753
754
755
756
757
758
759
760
761
762
  if (length === 0) return ''
  if (arguments.length === 0) return utf8Slice(this, 0, length)
  return slowToString.apply(this, arguments)
}


Buffer.prototype.toLocaleString = Buffer.prototype.toString


Buffer.prototype.equals = function equals (b) {
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  if (this === b) return true
fork icon0
star icon4
watch icon0

+ 6 other calls in file

1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
  if (length > K_MAX_LENGTH) {
    throw new RangeError('Invalid typed array length')
  }
  // Return an augmented `Uint8Array` instance
  var buf = new Uint8Array(length)
  buf.__proto__ = Buffer.prototype
  return buf
}


/**
fork icon0
star icon1
watch icon5

+ 20 other calls in file

584
585
586
587
588
589
590
591
592
593
594
if (Buffer.TYPED_ARRAY_SUPPORT) {
  Buffer.prototype.__proto__ = Uint8Array.prototype
  Buffer.__proto__ = Uint8Array
} else {
  // pre-set for values that may exist in the future
  Buffer.prototype.length = undefined
  Buffer.prototype.parent = undefined
}


function allocate (that, length) {
fork icon2
star icon0
watch icon0

+ 4 other calls in file

5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
  Buffer = _require.Buffer;
const _require2 = require('util'),
  inspect = _require2.inspect;
const custom = inspect && inspect.custom || 'inspect';
function copyBuffer(src, target, offset) {
  Buffer.prototype.copy.call(src, target, offset);
}
module.exports = class BufferList {
  constructor() {
    this.head = null;
fork icon0
star icon0
watch icon1

+ 89 other calls in file