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


\begin{DoxyCode}{0}
\DoxyCodeLine{var uniqueFilename = require('unique-\/filename')}
\DoxyCodeLine{}
\DoxyCodeLine{// returns something like: /tmp/912ec803b2ce49e4a541068d495ab570}
\DoxyCodeLine{var randomTmpfile = uniqueFilename(os.tmpdir())}
\DoxyCodeLine{}
\DoxyCodeLine{// returns something like: /tmp/my-\/test-\/912ec803b2ce49e4a541068d495ab570}
\DoxyCodeLine{var randomPrefixedTmpfile = uniqueFilename(os.tmpdir(), 'my-\/test')}
\DoxyCodeLine{}
\DoxyCodeLine{var uniqueTmpfile = uniqueFilename('/tmp', 'testing', '/my/thing/to/uniq/on') }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_unique_filename_README_autotoc_md31308}{}\doxysubsection{unique\+Filename($<$em$>$dir$<$/em$>$, $<$em$>$fileprefix$<$/em$>$, $<$em$>$uniqstr$<$/em$>$) → String}\label{md_sfcode_node_modules_unique_filename_README_autotoc_md31308}
Returns the full path of a unique filename that looks like\+: {\ttfamily dir/prefix-\/7ddd44c0} or {\ttfamily dir/7ddd44c0}

{\itshape dir} – The path you want the filename in. {\ttfamily os.\+tmpdir()} is a good choice for this.

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

{\itshape 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 reproducable way. 