Temp Directory
Path:
/src/method/tempdir.coffee
compiled to/lib/method/tempdir.js
This will create a new temporary directory for you. Since Node v5.10.0 you may
also use the mkdtemp()
method but it has a slightly changed API.
In this methods you define the temporary directory with two possible strings. First with the directory in which to create the new one and secondly a possible prefix before the numerical part.
Examples
You may get a directory back without doing anything:
CoffeeScript Code fs = require 'alinex-fs'
fs.tempdir (err, dir) ->
console.log "Temporary directory is: " + dir
But don’t forget to remove it if no longer needed.
tempdir()
Usage:
tempdir(base, [prefix=process, cb)
- Parameter
-
base
-String
path under which the directory should be created (usenull
for os default settings)[prefix=process
-String
title] to use before numerical partcb
-function(<Error>, <String>)
callback withError
or the path to the newly created directory
tempdirSync()
Usage:
tempdirSync({base=os, [prefix=process)
- Parameter
-
{base=os
-String
settings} path under which the directory should be created[prefix=process
-String
title] to use before numerical part
- Return
String
the path to the newly created directory- Throws
-
Error
if something went wrong