How to use the uuid.parse function in uuid

To help you get started, we’ve selected a few uuid 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 flow-typed / flow-typed / definitions / npm / uuid_v2.x.x / test_uuid_v2.x.x.js View on Github external
]
});

uuid.v4({
  // Fake random number generator
  rng: () => Buffer.alloc(16)
});

// $ExpectError
uuid.v4({
  rng: () => 'bla'
});

// $ExpectError
uuid.parse([23]);
const buffer1 = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10');
uuid.unparse(buffer1);
github flow-typed / flow-typed / definitions / npm / uuid_v2.x.x / test_uuid_v2.x.x.js View on Github external
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
  ]
});

uuid.v4({
  // Fake random number generator
  rng: () => Buffer.alloc(16)
});

// $ExpectError
uuid.v4({
  rng: () => 'bla'
});

// $ExpectError
uuid.parse([23]);
const buffer1 = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10');
uuid.unparse(buffer1);
github taskcluster / taskcluster-docs / assets / slugid-browserify.js View on Github external
exports.encode = function(uuid_) {
  var bytes   = uuid.parse(uuid_);
  var base64  = (new Buffer(bytes)).toString('base64');
  var slug = base64
              .replace(/\+/g, '-')  // Replace + with - (see RFC 4648, sec. 5)
              .replace(/\//g, '_')  // Replace / with _ (see RFC 4648, sec. 5)
              .substring(0, 22);    // Drop '==' padding
  return slug;
};
github Streampunk / node-red-contrib-dynamorse-core / model / Grain.js View on Github external
Grain.prototype.uuidToBuffer = function (id) {
  try {
    if (id === undefined || id === null) {
      return undefined;
    }
    if (typeof id === 'string') {
      let b = Buffer.allocUnsafe(16);
      uuid.parse(id, b);
      return b;
    }
    if (Buffer.isBuffer(id)) {
      return id.slice(0, 16);
    }
  }
  catch (e) {
    console.log(e);
    return undefined;
  }
  console.log('Could not parse value \'' + id + '\' to a UUID.');
  return undefined;
};
github Streampunk / dynamorse-deprecated / funnel / grainMaker.js View on Github external
function grainMaker(rateNumerator, rateDenominator, flowID, sourceID) {
  var start = Date.now() / 1000|0;
  var baseNanos = 0;
  var count = 0;

  function diffTime() {
    return nanoTime() - baseNanos;
  }

  console.log(flowID, sourceID);
  if (!Buffer.isBuffer(flowID))
    flowID = new Buffer(uuid.parse(flowID));
  if (!Buffer.isBuffer(sourceID))
    sourceID = new Buffer(uuid.parse(sourceID))
  console.log(flowID, sourceID);
  var timecode = new Buffer(8).fill(0);
  var duration = new Buffer(8);
  duration.writeUInt32BE(rateNumerator, 0);
  duration.writeUInt32BE(rateDenominator, 4);

  var grainGenerator = function (push, next) {
    var increment = baseNanos + count * rateDenominator * 1e9 / rateNumerator;
    var ptp = ptpToBuffer(start + increment/1e9|0, increment % 1e9);
    var g = new Grain([], ptp, ptp, timecode, flowID, sourceID, duration);
    push(null, g)
    next();
    count++;
  }

  return H(grainGenerator);
github Streampunk / dynamorse-deprecated / funnel / grainMaker.js View on Github external
function grainMaker(rateNumerator, rateDenominator, flowID, sourceID) {
  var start = Date.now() / 1000|0;
  var baseNanos = 0;
  var count = 0;

  function diffTime() {
    return nanoTime() - baseNanos;
  }

  console.log(flowID, sourceID);
  if (!Buffer.isBuffer(flowID))
    flowID = new Buffer(uuid.parse(flowID));
  if (!Buffer.isBuffer(sourceID))
    sourceID = new Buffer(uuid.parse(sourceID))
  console.log(flowID, sourceID);
  var timecode = new Buffer(8).fill(0);
  var duration = new Buffer(8);
  duration.writeUInt32BE(rateNumerator, 0);
  duration.writeUInt32BE(rateDenominator, 4);

  var grainGenerator = function (push, next) {
    var increment = baseNanos + count * rateDenominator * 1e9 / rateNumerator;
    var ptp = ptpToBuffer(start + increment/1e9|0, increment % 1e9);
    var g = new Grain([], ptp, ptp, timecode, flowID, sourceID, duration);
    push(null, g)
    next();
    count++;
  }
github Streampunk / dynamorse-deprecated / model / Grain.js View on Github external
Grain.prototype.uuidToBuffer = function (id) {
  try {
    if (id === undefined || id === null) {
      return undefined;
    }
    if (typeof id === 'string') {
      var b = new Buffer(16);
      uuid.parse(id, b);
      return b;
    }
    if (Buffer.isBuffer(id)) {
      return id.slice(0, 16);
    }
  }
  catch (e) {
    console.log(e);
    return undefined;
  }
  console.log("Could not parse value '" + id + "' to a UUID.");
  return undefined;
}
github organization / MineJS / sources / utils / Binary.js View on Github external
static writeUUID(uuid) {
        return require('uuid').parse(uuid);
    }
github Azure / node-red-contrib-azure / iot-hub / node_modules / amqp10 / lib / types.js View on Github external
      encoder: function(val, bufb) { bufb.appendBuffer(new Buffer(uuid.parse(val))); },
      decoder: function(buf) { return uuid.unparse(buf); }