Transform a 4-byte integer into a Buffer of length 4.

@param {number} integer
@return {Buffer}
516615
function integerAsBuffer(integer) {
    $.checkArgumentType(integer, 'number', 'integer');
    var bytes = [];
    bytes.push((integer >> 24) & 0xff);
    bytes.push((integer >> 16) & 0xff);
    bytes.push((integer >> 8) & 0xff);
    bytes.push(integer & 0xff);
    return new Buffer(bytes);
  }
1275373
function parseIntValue(input) {

    let value = input.buf.readInt32LE(input.i);
    input.i += 4;
    return value;
}
909157
function encode(buf) {
	if (buf.length != 8) {
		throw new TypeError("Buffer must be length 8");
	}

	var num = new UInt64(buf.readUInt32BE(4), buf.readUInt32BE(0));
	var str = "";
	do {
		num.div(SIXTY_TWO);
		str = CHARS[num.remainder] + str;
	} while (num.greaterThan(ZERO));

	return str;
}
284761
function() {
    var b = this.buffer, o = this.offset, carry = 1;
    for (var i = o + 7; i >= o; i--) {
      var v = (b[i] ^ 0xff) + carry;
      b[i] = v & 0xff;
      carry = v >> 8;
    }
  }
1158095
function toArray(buffer) {
    if(!buffer) buffer = new Buffer(0);
    var view = new Uint8Array(buffer.length);
    for (var i = 0; i < buffer.length; ++i) {
        view[i] = buffer[i];
    }
    return view;
  }
938404
function toBuffer(b) {
	// TODO: Use nodert-streams to more efficiently convert the buffer?
	let len = b.length;
	const DataReader = Windows.Storage.Streams.DataReader;
	let r = DataReader.fromBuffer(b);
	let a = new Uint8Array(len);
	for (let i = 0; i < len; i++) {
		a[i] = r.readByte();
	}
	return Buffer.from(a.buffer);
}
115521
function getBytes(len) {
    if (!len) {
        return new Uint8Array(0);
    }
    algo.getBytes(Math.round(Math.random() * len) + 1);
    var result = algo.getBytes(len);
    var cryptoBytes = CryptoEngine.random(len);
    for (var i = cryptoBytes.length - 1; i >= 0; --i) {
        result[i] ^= cryptoBytes[i];
    }
    return result;
}
308840
function decodeBufferCommon(encodedBuffer, index, signed) {
  index = index === undefined ? 0 : index;

  let length = encodedLength(encodedBuffer, index);
  const bitLength = length * 7;
  let byteLength = Math.ceil(bitLength / 8);
  let result = bufs.alloc(byteLength);
  let outIndex = 0;

  while (length > 0) {
    bits.inject(result, outIndex, 7, encodedBuffer[index]);
    outIndex += 7;
    index++;
    length--;
  }

  let signBit;
  let signByte;

  if (signed) {
    // Sign-extend the last byte.
    let lastByte = result[byteLength - 1];
    const endBit = outIndex % 8;
    if (endBit !== 0) {
      const shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints.
      lastByte = result[byteLength - 1] = ((lastByte << shift) >> shift) & 0xff;
    }
    signBit = lastByte >> 7;
    signByte = signBit * 0xff;
  } else {
    signBit = 0;
    signByte = 0;
  }

  // Slice off any superfluous bytes, that is, ones that add no meaningful
  // bits (because the value would be the same if they were removed).
  while (
    byteLength > 1 &&
    result[byteLength - 1] === signByte &&
    (!signed || result[byteLength - 2] >> 7 === signBit)
  ) {
    byteLength--;
  }
  result = bufs.resize(result, byteLength);

  return { value: result, nextIndex: index };
}
596302
function copyBuffer(buf, pos, len) {
  var copy = utils.newBuffer(len);
  buf.copy(copy, 0, pos, pos + len);
  return copy;
}
146050
function BIGINT (length) {
    length = length || 11;
    if (!(this instanceof BIGINT)) {
        return new BIGINT(length);
    }
    this.length = length > 11 ? 11 : length;
    this.sql = 'BIGINT(' + this.length + ')';
}
334975
function amf0encNumber(num) {
    var buf = new Buffer(9);
    buf.writeUInt8(0x00, 0);
    buf.writeDoubleBE(num, 1);
    return buf;
}
895675
function (num) {
  var arr = [];

  if (num === 0) return new Buffer([0]);

  // Break up num into groups of 7-bit values
  while (num) {
    arr.unshift(num & (127));
    num >>= 7;
  }

  // Flip MSB of all 7-bit values except the last one
  arr = _.map(_.initial(arr), function (val, i) {
    return val + 128;
  }).concat(_.last(arr));

  return new Buffer(arr);
}
809811
function bnToBuffer( bn ) {
  var hex = bn.toString( 16 )
  hex = hex.length % 2 === 1 ? '0' + hex : hex
  return Buffer.from( hex, 'hex' )
}
1358333
public static byte[] integerToBytes(BigInteger s, int length) {
      byte[] bytes = s.toByteArray();
      if (length < bytes.length) {
         // The length is smaller than the byte representation. Truncate by
         // copying over the least significant bytes
         byte[] tmp = new byte[length];
         System.arraycopy(bytes, bytes.length - tmp.length, tmp, 0, tmp.length);
         return tmp;
      } else if (length > bytes.length) {
         // The length is larger than the byte representation. Copy over all
         // bytes and leave it prefixed by zeros.
         byte[] tmp = new byte[length];
         System.arraycopy(bytes, 0, tmp, tmp.length - bytes.length, bytes.length);
         return tmp;
      }
      return bytes;
   }
1036315
def int_to_bytes(int_, width = None):
	
	if(width == None):
		width = int_.bit_length()
	byts = math.ceil(width / 8)
	return bytes([ (int_ >> (shift * 8)) & 0xff for shift in range(byts)])
529911
function funBuffer(size) {
    var buffer = new Buffer(size)
    for (var i=0; i<size; i++) {
        if (i%1000 == 0) buffer[i++] = 13
        buffer[i] = 97 + (i%26)
    }
    return buffer
}
854355
function getByte(array, position, length) {
  const d = position % 8;
  const a = Math.floor(position / 8);
  const de = 8 - d;
  const ef = (position + length) - ((a + 1) * 8);
  let fg = (8 * (a + 2)) - (position + length);
  const dg = ((a + 2) * 8) - position;
  fg = Math.max(0, fg);
  if (a >= array.length) {
    console.warn('ran off the end of the buffer before finding EOI_CODE (end on input code)');
    return EOI_CODE;
  }
  let chunk1 = array[a] & ((2 ** (8 - d)) - 1);
  chunk1 <<= (length - de);
  let chunks = chunk1;
  if (a + 1 < array.length) {
    let chunk2 = array[a + 1] >>> fg;
    chunk2 <<= Math.max(0, (length - dg));
    chunks += chunk2;
  }
  if (ef > 8 && a + 2 < array.length) {
    const hi = ((a + 3) * 8) - (position + length);
    const chunk3 = array[a + 2] >>> hi;
    chunks += chunk3;
  }
  return chunks;
}