New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

uid-promise

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uid-promise

generates a cryptographically strong random uid

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-3.86%
Maintainers
1
Weekly downloads
 
Created
Source

uid-promise

Creates a cryptographically strong UID with a 62 character range that can be safely used in URLs.

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789

How to use

import uid from 'uid-promise';
export default async function getURL () {
  const id = await uid(20);
  return `https://myhost.com/p/${id}`;
}

API

uid(len) => Promise

  • Return a Promise that resolves with a string of random characters of length len.
  • len must always be provided, else the promise is rejected
  • Under the hood, crypto.randomBytes is used.

Credits

  • Copyright © 2016 Zeit, Inc and project authors.
  • Licensed under MIT.

FAQs

Package last updated on 07 Mar 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc