Gathering detailed insights and metrics for uniquefilename
Gathering detailed insights and metrics for uniquefilename
Gathering detailed insights and metrics for uniquefilename
Gathering detailed insights and metrics for uniquefilename
npm install uniquefilename
Typescript
Module System
Min. Node Version
Node Version
NPM Version
71.3
Supply Chain
98.8
Quality
75.3
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2 Stars
34 Commits
1 Forks
2 Watchers
1 Branches
2 Contributors
Updated on Dec 28, 2020
Minified
Minified + Gzipped
Latest Version
1.1.2
Package Id
uniquefilename@1.1.2
Size
4.95 kB
NPM Version
3.9.5
Node Version
6.2.2
Published on
Feb 28, 2017
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A module to get a filename - that doesn't already exist on the filesystem - using incremental values.
1npm install uniquefilename
1var uniquefilename = require('uniquefilename'); 2options = {}; 3uniquefilename.get('/path/to/dir/file.jpg', options, function(filename) { 4 // filename might be "/path/to/dir/file.jpg", 5 // "/path/to/dir/file-2.jpg", "/path/to/dir/file-3.jpg", etc... 6 // depending on the files that exist on your filesystem 7});
If a callback is not supplied, a Promise is returned (using bluebird).
1var uniquefilename = require('uniquefilename'); 2uniquefilename.get('/path/to/dir/file.jpg', {}).then(function (filename) { 3 console.log(filename); 4});
1var uniquefilename = require('uniquefilename'); 2options = {separator: '~', paddingCharacter: '0', paddingSize: 4, mode: 'alphanumeric'}; 3uniquefilename.get('/path/to/dir/file.jpg', options, function(filename) { 4 // filename might be "/path/to/dir/file.jpg", 5 // "/path/to/dir/file~000h.jpg", "/path/to/dir/file~00h9.jpg", etc... 6 // depending on the files that exist on your filesystem 7});
If the specified filename exists, the separator will be added before the incremental value such as: file{separator}2.jpg
The default value is '-'
.
The mode allows you to specify which characters to use to generate the incremental value (the string after the separator)
The default value is 'numeric'
.
'numeric'
Using the following characters: 1234567890
'alpha'
Using the following characters: abcdefghijklmnopqrstuvwxyz
'ALPHA'
Using the following characters: ABCDEFGHIJKLMNOPQRSTUVWXYZ
'alphanumeric'
Using the following characters: 0123456789abcdefghijklmnopqrstuvwxyz
'ALPHANUMERIC'
Using the following characters: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
'charset'
You must specify the characters you wish to use in the charset
optionIf you wish to left-pad the incremental values with a character, use this option. Here's an example :
1var uniquefilename = require('uniquefilename'); 2options = {mode: 'alpha', paddingCharacter: '0', paddingSize: 3}; 3uniquefilename.get('/path/to/dir/file.jpg', options, function(filename) { 4 // filename might be "/path/to/dir/file.jpg", 5 // "/path/to/dir/file-002.jpg", "/path/to/dir/file-045.jpg", etc... 6 // depending on the files that exist on your filesystem 7});
Multer is a node.js middleware for handling multipart/form-data
, which is primarily used for uploading files.
The following example shows you how to use multer along with this module to move an uploaded file to a unique filename :
1var multer = require('multer'); 2var path = require('path'); 3var uniquefilename = require('uniquefilename'); 4 5router.use(multer({ 6 storage: multer.diskStorage({ 7 destination: function (req, file, cb) { 8 cb(null, './public/uploads/') 9 }, 10 filename: function (req, file, cb) { 11 originalname = path.resolve('./public/uploads/' + file.originalname); 12 options = {}; 13 uniquefilename.get(originalname, options, function(filename) { 14 cb(null, path.basename(filename)); 15 }); 16 } 17 }) 18}).single('thumbnail'));
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/27 approved changesets -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
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