{"id":15290146,"url":"https://github.com/npm/unique-filename","last_synced_at":"2025-05-15T17:03:57.231Z","repository":{"id":31682483,"uuid":"35248053","full_name":"npm/unique-filename","owner":"npm","description":"Generate a unique filename for use in temporary directories or caches.","archived":false,"fork":false,"pushed_at":"2025-04-28T18:58:12.000Z","size":85,"stargazers_count":45,"open_issues_count":1,"forks_count":8,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-03T01:03:35.105Z","etag":null,"topics":["npm-cli"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-05-07T23:11:46.000Z","updated_at":"2025-04-28T18:58:14.000Z","dependencies_parsed_at":"2024-04-20T22:58:07.692Z","dependency_job_id":"076fe5ee-6c0c-4e26-92c3-9dc2bd6ca9ee","html_url":"https://github.com/npm/unique-filename","commit_stats":{"total_commits":68,"total_committers":9,"mean_commits":7.555555555555555,"dds":0.6176470588235294,"last_synced_commit":"938ae3b0b32b97f4903acdb0398688cdf4772a57"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Funique-filename","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Funique-filename/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Funique-filename/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Funique-filename/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npm","download_url":"https://codeload.github.com/npm/unique-filename/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254040138,"owners_count":22004453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["npm-cli"],"created_at":"2024-09-30T16:05:39.452Z","updated_at":"2025-05-15T17:03:57.183Z","avatar_url":"https://github.com/npm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"unique-filename\n===============\n\nGenerate a unique filename for use in temporary directories or caches.\n\n```js\nconst uniqueFilename = require('unique-filename')\n\n// returns something like: '/tmp/c5b28f47'\nconst randomTmpfile = uniqueFilename(os.tmpdir())\n\n// returns something like: '/tmp/my-test-51a7b48d'\nconst randomPrefixedTmpfile = uniqueFilename(os.tmpdir(), 'my-test')\n\n// returns something like: '/my-tmp-dir/testing-7ddd44c0'\nconst uniqueTmpfile = uniqueFilename('/my-tmp-dir', 'testing', '/my/thing/to/uniq/on')\n```\n\n### uniqueFilename(*dir*, *fileprefix*, *uniqstr*) → String\n\nReturns the full path of a unique filename that looks like:\n`dir/prefix-7ddd44c0`\nor `dir/7ddd44c0`\n\n*dir* – The path you want the filename in. `os.tmpdir()` is a good choice for this.\n\n*fileprefix* – A string to append prior to the unique part of the filename.\nThe parameter is required if *uniqstr* is also passed in but is otherwise\noptional and can be `undefined`/`null`/`''`. If present and not empty\nthen this string plus a hyphen are prepended to the unique part.\n\n*uniqstr* – Optional, if not passed the unique part of the resulting\nfilename will be random.  If passed in it will be generated from this string\nin a reproducible way.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Funique-filename","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpm%2Funique-filename","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Funique-filename/lists"}