Socket
Socket
Sign inDemoInstall

uuid

Package Overview
Dependencies
0
Maintainers
0
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    uuid

Simple libuuid bindings to allow UUIDs to be generated from JS.


Version published
Weekly downloads
99M
decreased by-3.05%
Maintainers
0
Created
Weekly downloads
 

Package description

What is uuid?

The uuid npm package is used to generate universally unique identifiers (UUIDs), which are 128-bit numbers used to uniquely identify information in computer systems. The package supports multiple versions of UUIDs, each with different methods of generation based on requirements such as randomness, time-based generation, and name-based generation using namespaces.

What are uuid's main functionalities?

Generate UUID v1

Generates a version 1 UUID based on timestamp and MAC address of the host machine, ensuring temporal uniqueness.

const { v1: uuidv1 } = require('uuid');
console.log(uuidv1());

Generate UUID v4

Generates a version 4 UUID using random or pseudo-random numbers, providing a higher degree of randomness.

const { v4: uuidv4 } = require('uuid');
console.log(uuidv4());

Generate UUID v3

Generates a version 3 UUID using MD5 hashing of a namespace identifier and a name.

const { v3: uuidv3 } = require('uuid');
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
console.log(uuidv3('Hello, World!', MY_NAMESPACE));

Generate UUID v5

Generates a version 5 UUID using SHA-1 hashing of a namespace identifier and a name, providing better uniqueness and lower collision probability than v3.

const { v5: uuidv5 } = require('uuid');
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
console.log(uuidv5('Hello, World!', MY_NAMESPACE));

Other packages similar to uuid

FAQs

Last updated on 31 Mar 2011

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc