3.0.0 • Published 2 years ago

unique-filename v3.0.0

Weekly downloads
11,345,283
License
ISC
Repository
github
Last release
2 years ago

unique-filename

Generate a unique filename for use in temporary directories or caches.

const uniqueFilename = require('unique-filename')

// returns something like: '/tmp/c5b28f47'
const randomTmpfile = uniqueFilename(os.tmpdir())

// returns something like: '/tmp/my-test-51a7b48d'
const randomPrefixedTmpfile = uniqueFilename(os.tmpdir(), 'my-test')

// returns something like: '/my-tmp-dir/testing-7ddd44c0'
const uniqueTmpfile = uniqueFilename('/my-tmp-dir', 'testing', '/my/thing/to/uniq/on')

uniqueFilename(dir, fileprefix, uniqstr) → String

Returns the full path of a unique filename that looks like: dir/prefix-7ddd44c0 or dir/7ddd44c0

dir – The path you want the filename in. os.tmpdir() is a good choice for this.

fileprefix – A string to append prior to the unique part of the filename. The parameter is required if uniqstr is also passed in but is otherwise optional and can be undefined/null/''. If present and not empty then this string plus a hyphen are prepended to the unique part.

uniqstr – Optional, if not passed the unique part of the resulting filename will be random. If passed in it will be generated from this string in a reproducible way.

cacachevuedragdropuploadimagespopsmart-common-authkilli8n-react-native-fast-imageinvoicewave_back@cashremit/cr-streamline-iconsbb-chat@frxf/frxf@texttree/demo-bsa-reference-rcl@fundefund/funde_ckgql_din_mod@l1nyanm1ng/react-picture-viewer@saeon/ol-react@saeon/quick-formcogoportutilsjs4cytoscape@mink-opn/build-tokens@saaspe/componentsexpand-react-bridgenode-gio@everything-registry/sub-chunk-3013jawwy-sdkreact-native-sphereuisphereuilabtesttwol2forlernalitepie-datepicker-gabemyui5librarychenmyui5librarymobomynancemiguelcostero-ng2-toastymiracle-webpack-tree-shakingmongo-gridfsmd-vditorneural_compressor_ext_lab_customizedneural_compressor_ext_lab_customized_2naver-npmnpmcnpm5vnpm5@faizanhaider/iconsaxnuxtpaginations@farvater/open-pedigree@elsouza1985/react-org-chartnois-react-toast@enirisdev/angular-google-charts@fabwcie/ckeditor5-previewnst-cli@evocateur/pacotenpm-prognpm-msys2@simstudio/htmldiffzzzxxxyyy321123mangudinlagirajinluojia-cli-devm2m-chartjs-plugin-crosshairmyreuselibraryquicknex@jasonssun/npmqa_hddqyx-hmtldiff@kristoffertonning/vue-laravel-errors@kirrosh/pts@kuinox/testpackagethatnooneshoulduse@kuinox/testpackagethatnooneshoulduseever@krwhitley/neatapticreact-form-component-library@hproinformatica/functionspileuleuyantea@hieuquang2212/form@haxcms/sdknot-bundled-npm@ericmcornelius/easeng-search-dropdownnode-cucumber-testrail-sync-featurefilesreact-native-rtn-ips-poslin-testreact-native-sandycomponentreact-native-recent-framework-updatereact-native-rn-app@masol/pipelinereact-otp-input-uptd@marinaga/bananizereact-picky-with-clearreact-native-lib-test-rn-1react-native-dimensions-layoutreact-native-fedlight-dsmreact-native-awesome-module-latestreact-native-nativewindreact-native-multiplyreact-native-module-arge@jarrydark/editorsimplejs@juanzenn/ckeditor5-custom-buildqxf2006hf0216react-misc-toolbox@lego-js/tests@idas1/ui-component-lib@icetee/react-recaptcha-v3null-session-npm@innodata/vue-v3-ya-metrikaprova-2-carosello
3.0.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

6 years ago

1.1.0

8 years ago

1.0.0

9 years ago