deserialize-uuid

0.1.1 • Public • Published

node-deserialize-uuid

extracts the timestamp from a version 1 UUID

install

npm install deserialize-uuid

use

pass it a uuid-compatible uuid string

require('deserialize-uuid')('0c1d16c8-5c6a-11e4-90cf-12313b0e448d')

returns

{
  timestamp: <BigNum 136335499267479240>,
  timestampUtc: 1414275126747
}

timestamp is a BigNum for the integral value of the uuid's timestamp field (see RFC4122). timestampUtc is the difference in whole milliseconds between the moment that the timestamp field represents and the UNIX epoch. That means you can do new Date(timestampUtc).

Ideally it would also return the RFC4122 "node" and "clock sequence" fields, but I haven't implemented this yet.

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i deserialize-uuid

    Weekly Downloads

    0

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • rschaosid