
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
node-time-uuid
Advanced tools
Node module to generate globally unique, time sortable indentifiers that can be used as database unique IDs. The identifiers are time sortable and you can recover the time stamp of when they were created down to micro-second resolution. Time sortable iden
Node module to generate globally unique, time sortable indentifiers that can be used as database unique IDs. The identifiers are time sortable and you can recover the time stamp of when they were created down to micro-second resolution. Time sortable identifiers can very useful in situations where you want to sort your objects by time, for instance messages in a user's inbox.
This module generates 15 byte IDs with the following format:
Please note that the generated IDs are not standard UUID, or GUID.
Simple installation with NPM
npm install node-time-uuid
var ObjectId = require("node-time-uuid");
var id = new ObjectId();
// get date from Id
var date = id.getDate();
// get timestamp from Id
var timestamp = id.getTimestamp();
// get timestamp and microsecond time
var [timestamp, microseconds] = id.getTimeOfDay();
ObjectId can be instanciated in several different ways:
var ObjectId = require("node-time-uuid");
// Create a new ID
var id = new ObjectId();
// Create an Object Id instance from existing Id encoded as a Hex string
var id = new ObjectId("512055ac09b8979d8fa1511f000002");
// Create an Object Id instance from existing Id encoded as base64 string
var id = new ObjectId("USBVrAm4l52PoVEfAAAC");
// Create an Object Id instance from existing Node buffer
var id = new ObjectId(buffer);
Supported encodings are hex, base64 and base64url
Returns a 15 byte Node.js Buffer object with the Id.
var buffer = id.get();
Returns a string representation of ObjectId, according to the specified enconding. Supported encodings are hex, base64, base64url, pretty.
Get the unix timestamp from the ObjectId
var timestamp = id.getTimestamp();
Get timestamp of the ObjectId in seconds and microseconds
var [timestamp, microseconds] = id.getTimeOfDay();
Return Javascript Date() object from the ObjectId.
Tests require Node mocha and istanbul modules to be installed .
npm install mocha istanbul -g
To run all module tests simply run:
npm test
or
make test
To obtain a test coverage report run
npm cover
Then open ./html-report/index.html in your browser
#License
MIT License
FAQs
Node module to generate globally unique, time sortable indentifiers that can be used as database unique IDs. The identifiers are time sortable and you can recover the time stamp of when they were created down to micro-second resolution. Time sortable iden
We found that node-time-uuid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.