1. Nikhil Marathe
  2. uuidjs
Issue #1 resolved

Binary UUID generation

weaver
created an issue

Hi,

I needed access to the raw, 16-byte UUID created by uuid_generate() so I modified the Generate function to accept an optional encoding parameter. A patch is attached. If you have time to review the patch and merge it in or provide similar functionality in a different way, I'd appreciate it.

Many thanks,

-Ben

Comments (6)

  1. Nikhil Marathe repo owner

    I believe that the patch you have attached is incomplete, I see only the slight changes in the generate function, but I don't have your definitions of BINARY and ASCII and Export() etc. Please attach those.

    I would have to consider this, since returning the 16byte binary would make more sense returned as a Buffer than a string.

  2. weaver reporter

    Hi Nikhil,

    Thanks for the quick response. The definitions of BINARY, ASCII, and Encode() are part of Node (node.h and node.cc).

    I considered using a Buffer, but implemented it using Encode(..., BINARY) in an effort to mimic methods in Node's Crypto module (e.g. hash.digest(encoding)). I don't care very much; I'm happy to modify the patch if you prefer Buffers.

    Best wishes,

    -Ben

  3. Log in to comment