create a unique temporary directory.
luarocks install mkdtemp
local mkdtemp = require('mkdtemp')
local pathname = assert(mkdtemp('/tmp/lua_XXXXXX'))
print(pathname) -- /tmp/lua_Wo6kHb
the following functions return the error
object created by https://github.com/mah0x211/lua-errno module.
this function takes the given file name template tmpl
and overwrites a portion of it to create a directory name and the template directory.
see man mkdtemp
for more details.
Parameters
tmpl:string
: filename template.
Returns
pathname:string
: pathname of the created directory.err:error
:error
object on failure.