How to use the int64-buffer.Uint64BE function in int64-buffer

To help you get started, we’ve selected a few int64-buffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rockstat / front / src / lib / id / snow_flake.ts View on Github external
take(): string {
    const idBuff = this.idGen.next();
    return new Uint64BE(idBuff).toString();
  }
github magne4000 / node-qtdatastream / lib / writer.js View on Github external
Writer.prototype.writeUInt64 = function(i){
    var b = UInt64(i).toBuffer();
    this.write(b);
    return this;
};
github MicroMinion / curvecp / src / packet-stream.js View on Github external
PacketStream.prototype.__validNonce = function (message, offset) {
  var remoteNonce = new Uint64BE(new Buffer(message.subarray(offset, 8).reverse())).toNumber()
  if (remoteNonce > this.__remoteNonceCounter || (this.__remoteNonceCounter === 0 && remoteNonce === 0)) {
    this.__remoteNonceCounter = remoteNonce
    return true
  } else {
    return false
  }
}
github commaai / cabana / src / models / can-msg-fmt.js View on Github external
export function uint64BEToHex(int64) {
  return Uint64BE(int64).toString(16);
}
github magne4000 / node-qtdatastream / src / buffer.js View on Github external
readUInt64BE() {
    const result = (new Uint64BE(this.buffer, this.read_offset)).toNumber();
    this.read_offset += 8;
    return result;
  }
github L-Leite / cso2-master-server / src / packets / in / packet.ts View on Github external
public readUInt64(bigEndian: boolean = false): Uint64LE | Uint64BE {
        if (this.canReadBytes(8) === false) {
            throw new Error('Data buffer is too small')
        }
        const res: Uint64LE | Uint64BE = bigEndian ?
            new Uint64BE(this.packetData, this.curOffset) :
            new Uint64LE(this.packetData, this.curOffset)
        this.curOffset += 8
        return res
    }
github rockstat / rockme-framework / src / ids / the-ids.ts View on Github external
static SInt64ToBase64(str: string): string {
    return new Uint64BE(str, 10).toBuffer().toString('base64')
  }
github MicroMinion / curvecp / src / packet-stream.js View on Github external
PacketStream.prototype._createNonceFromCounter = function (prefix) {
  this._increaseCounter()
  var nonce = new Uint8Array(24)
  nonce.set(nacl.util.decodeUTF8(prefix))
  var counter = new Uint8Array(new Uint64BE(this.__ourNonceCounter).toBuffer()).reverse()
  nonce.set(counter, 16)
  return nonce
}
github commaai / cabana / src / models / can-msg-fmt.js View on Github external
export function int64BufferToPrettyHexStr(buffer) {
  const uint = Uint64BE(buffer);
  let hex = uint.toString(16);
  if (hex.length === 1) hex = `0${hex}`;
  const hexParts = hex.match(/.{1,2}/g);

  return hexParts.join(' ');
}

int64-buffer

64bit Long Integer on Buffer/Array/ArrayBuffer in Pure JavaScript

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis