npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

random-unique-id

v2.1.0

Published

Generate 128bit hex unique id using true random seed, micro-second timestamp and counter for entropy

Downloads

23

Readme

random-unique-id

Random Unique ID generates a 128-bit hex random id using crypto.randomBytes as an initial seed and then concatenating this with a micro-second timestamp and an incrementing counter and performing an SHA-256 hash to generate each unique id.

Random Unique IDs are intended to start from a truly random base and subsequently to be deterministic but pseudo random.

As of version 1.0.0 the id is lower case where previously it was upper case.

Usage

const randomUniqueId = require('random-unique-id')

var uniqueId = randomUniqueId()

uniqueId.id        // 62793faaa26a55036957b79e3ef6a51b
uniqueId.timestamp // 2017-05-29 21:18:31.844178

Random Unique ID returns an object with both the generated id and the timestamp that was used to generate it.

Accessing internal data

const randomUniqueId = require('random-unique-id')

randomUniqueId.count     // 0
randomUniqueId.id        // undefined
randomUnqiueId.seed      // 2ff54616eb6a411059031f77c2091771254e03daf4d3a431f70d13ba912e86b3
randomUniqueId.processId // 06c441675a07ae8790e09e520ac05e86bce6ded412020a82e54bb762b336935a


randomUniqueId()

randomUniqueId.count     // 1
randomUniqueId.id        // 7027ce98ca0ed9915841ac4fd7a74d42
randomUnqiueId.seed      // 2ff54616eb6a411059031f77c2091771254e03daf4d3a431f70d13ba912e86b3
randomUniqueId.processId // 06c441675a07ae8790e09e520ac05e86bce6ded412020a82e54bb762b336935a

Internal state data is exposed as properites of the unique id function. The id will always contain the last id generated or be undefined if no ids have been generated.