Socket
Socket
Sign inDemoInstall

uuidgenv4

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    uuidgenv4

Generates UUIDv4 values


Version published
Weekly downloads
6
increased by500%
Maintainers
1
Install size
76.7 kB
Created
Weekly downloads
 

Readme

Source

uuidgenv4

Generates UUIDv4 (122 bit random) instances.

Usage:

import { UUID, UUIDsync, UUIDtoString, StringToUUID } from 'uuidgenv4'

UUID().then(uuid => {
	// do stuff like db keys and so on
})

UUID(Buffer.alloc(16), false).then(buf => {
	// it's a 16 byteLength Uint8Array instance. write it to disk or something
})

let b = Buffer.alloc(36)
b.write('IAmYourFather', 0, 20, 'ascii')

UUID(b, false, 20).then(buf => {
	// also a 16 byteLength Uint8Array instance. Shares memory with b.
})

let key = UUIDsync()
console.log(key)
// 8-4-4-4-12
console.log(StringToUUID(key))
// Uint8Array [...]

Keywords

FAQs

Last updated on 25 Feb 2019

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