Gathering detailed insights and metrics for short-uuid
Gathering detailed insights and metrics for short-uuid
Gathering detailed insights and metrics for short-uuid
Gathering detailed insights and metrics for short-uuid
short-unique-id
Generate random or sequential UUID of any length
shortid
Amazingly short non-sequential url-friendly unique id generator.
time-uuid
Universally unique identifier in short web friendly (non UUID) format
shorten-uuid
Shorten UUID to a string of length 24 witch applicable to the URL and WeChat QR code.
Translate standard UUIDs into shorter formats and back.
npm install short-uuid
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.2
Supply Chain
100
Quality
78.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
54,164,348
Last Day
18,860
Last Week
398,233
Last Month
1,714,669
Last Year
16,480,314
MIT License
495 Stars
193 Commits
13 Forks
4 Watchers
5 Branches
8 Contributors
Updated on Jun 14, 2025
Minified
Minified + Gzipped
Latest Version
5.2.0
Package Id
short-uuid@5.2.0
Unpacked Size
71.18 kB
Size
15.49 kB
File Count
19
NPM Version
6.14.8
Node Version
14.15.0
Published on
May 02, 2024
Cumulative downloads
Total Downloads
Last Day
19.1%
18,860
Compared to previous day
Last Week
-7.6%
398,233
Compared to previous week
Last Month
10.1%
1,714,669
Compared to previous month
Last Year
34.4%
16,480,314
Compared to previous year
5
Generate and translate standard UUIDs into shorter - or just different - formats and back.
5.2.0 adds validate
method to check short IDs. Requested by @U-4-E-A
5.1.0 adds translation support for the uuid25 (Base36) format
with the uuid25Base36
constant.
1const short = require('short-uuid'); 2 3// Quick start with flickrBase58 format 4short.generate(); // '73WakrfVbNJBaAmhQtEeDv'
short-uuid starts with RFC4122 v4-compliant UUIDs and translates them into other, usually shorter formats. It also provides translators to convert back and forth from RFC compliant UUIDs to the shorter formats, and validate the IDs.
As of 4.0.0, formats return consistent-length values unless specifically requested.
This is done by padding the start with the first ([0]
) character in the alphabet.
Previous versions can translate padded formats back to UUID.
1const short = require('short-uuid'); 2 3// Generate a flickrBase58 short ID from without creating a translator 4const shortId = short.generate(); 5 6const translator = short(); // Defaults to flickrBase58 7const decimalTranslator = short("0123456789"); // Provide a specific alphabet for translation 8const cookieTranslator = short(short.constants.cookieBase90); // Use a constant for translation 9 10// Generate a shortened v4 UUID 11translator.new(); // mhvXdrZT4jP5T8vBxuvm75 12translator.generate(); // An alias for new. 13 14// Translate UUIDs to and from the shortened format 15translator.toUUID(shortId); // a44521d0-0fb8-4ade-8002-3385545c3318 16translator.fromUUID(regularUUID); // mhvXdrZT4jP5T8vBxuvm75 17 18// Check if a string is a valid ID (length and alphabet) 19translator.validate(shortId); // true 20 21// Check if a string is valid *AND* translates to a valid UUID 22translator.validate(shortId, true); // true 23translator.validate('0000000000000000000000', true) // false 24 25// See the alphabet used by a translator 26translator.alphabet; 27 28// The maximum length a translated uuid will be with its alphabet. 29// if consistentLength is set (on by default), so ids will be this length. 30translator.maxLength; 31 32// View the constants 33short.constants.cookieBase90; // Safe for HTTP cookies values for smaller IDs. 34short.constants.flickrBase58; // Avoids similar characters (0/O, 1/I/l, etc.) 35short.constants.uuid25Base36; // The uuid25 (string length 25) format 36 37// Generate plain UUIDs 38// - From the library without creating a translator 39short.uuid(); // fd5c084c-ff7c-4651-9a52-37096242d81c 40// - Each translator provides the uuid.v4() function, too 41translator.uuid(); // 3023b0f5-ec55-4e75-9cd8-104700698052
short-uuid 4.0.0 added support for options when creating a translator. This may support additional configuration in the future.
1const short = require('short-uuid'); 2 3// By default shortened values are now padded for consistent length. 4// If you want to produce variable lengths, like in 3.1.1 5const translator = short(short.constants.flickrBase58, { 6 consistentLength: false, 7}); 8 9// Generate a shortened v4 UUID 10translator.new(); // mhvXdrZT4jP5T8vBxuvm75
consistentLength
- Controls padding on shortened values. Default is true
.short-uuid 5.x and later is tested on Node 14.x and later.
short-uuid 4.x was tested on Node 8.x to 18.x
short-uuid 3.x and lower was confirmed to work on Node 6.x to 12.x, and offered a precompiled browser library proposed by voronianski.
short-uuid provides RFC4122 v4-compliant UUIDs,
thanks to uuid
.
TypeScript definitions are included, thanks to alexturek.
5.0.0 drops support for Node 12 and below. 4.1.0 adds a maxLength value to translators for reference 4.0.1 adds consistent length translation and throws an error if provided an invalid alphabet. 3.1.1 removed Node 4.x tests. Last included Browserify distribution. 2.3.4 corrects the behavior for UUIDs with uppercase letters. Last version to build on Node 0.x.
Please see Revisions for information on previous versions.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
Found 3/14 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-09
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More