Global

Members

(constant) tmpDir :string

The temporary directory.
Type:
  • string
Source:

Methods

dir(options, callbacknullable)

Creates a temporary directory.
Parameters:
Name Type Attributes Description
options Options | dirCallback the options or the callback function
callback dirCallback <nullable>
Source:

dirSync(options) → {DirSyncObject}

Synchronous version of dir.
Parameters:
Name Type Description
options Options
Source:
Throws:
if it cannot create a directory
Type
Error
Returns:
object consists of name and removeCallback
Type
DirSyncObject

file(options, callbacknullable)

Creates and opens a temporary file.
Parameters:
Name Type Attributes Description
options Options | fileCallback the config options or the callback function
callback fileCallback <nullable>
Source:

fileSync(options) → {FileSyncObject}

Synchronous version of file.
Parameters:
Name Type Description
options Options
Source:
Throws:
if cannot create a file
Type
Error
Returns:
object consists of name, fd and removeCallback
Type
FileSyncObject

setGracefulCleanup()

Sets the graceful cleanup. Also removes the created files and directories when an uncaught exception occurs.
Source:

tmpName(options, callbacknullable)

Gets a temporary file name.
Parameters:
Name Type Attributes Description
options Options | tmpNameCallback options or callback
callback tmpNameCallback <nullable>
the callback function
Source:

tmpNameSync(options) → {string}

Synchronous version of tmpName.
Parameters:
Name Type Description
options Object
Source:
Throws:
if the options are invalid or could not generate a filename
Type
Error
Returns:
the generated random name
Type
string

Type Definitions

cleanupCallback(nextopt)

Removes the temporary created file or directory.
Parameters:
Name Type Attributes Description
next simpleCallback <optional>
function to call after entry was removed
Source:

dirCallback(errnullable, name, fn)

Parameters:
Name Type Attributes Description
err Error <nullable>
the error object if anything goes wrong
name string the temporary file name
fn cleanupCallback the cleanup callback function
Source:

DirSyncObject

Type:
  • Object
Properties:
Name Type Description
name string the name of the directory
removeCallback fileCallback the callback function to remove the directory
Source:

fileCallback(errnullable, name, fd, fn)

Parameters:
Name Type Attributes Description
err Error <nullable>
the error object if anything goes wrong
name string the temporary file name
fd number the file descriptor
fn cleanupCallback the cleanup callback function
Source:

FileSyncObject

Type:
  • Object
Properties:
Name Type Description
name string the name of the file
fd string the file descriptor
removeCallback fileCallback the callback function to remove the file
Source:

Options

Configuration options.
Type:
  • Object
Properties:
Name Type Attributes Description
tries number <nullable>
the number of tries before give up the name generation
template string <nullable>
the "mkstemp" like filename template
name string <nullable>
fix name
dir string <nullable>
the tmp directory to use
prefix string <nullable>
prefix for the generated name
postfix string <nullable>
postfix for the generated name
Source:

simpleCallback()

Callback function for function composition.
Source:
See:

tmpNameCallback(errnullable, name)

Parameters:
Name Type Attributes Description
err Error <nullable>
the error object if anything goes wrong
name string the temporary file name
Source: