temp service

Helps configure and manage a temporary folder for Tymly to use. This service is provided via the tymly plugin and isn't offered by any of the other core plugins.

Boot config

{
  "tempDir": "/some/dir/somewhere"
}
Property Type Description Required
tempDir string A path pointing to a directory to use as an alternative to the system-allocated temp dir No

Service methods/properties

tempDir

This is the value as derived by first considering if a tempDir value is specified in the config, failing that if a $TYMLY_TEMPDIR environment variable has been set… and if all else fails use the system temp dir (i.e. the value returned by os.tmpdir())

Properties

  • tempDir string The root of Tymly’s temporary directory

Examples

console.log(temp.tempDir) // /some/absolute/dir

makeTempDir

Makes a new temporary directory using mkdirp

Parameters

  • subDirPath string A sub dir to create relative to temp.tempDir
  • callback Function called with the absolute path to the dir that was created

Examples

temp.makeDirPath(
  'some/subDir',},
  function (err, fullPath) {
    // Where fullPath would be something absolute, e.g:
    //   /temp/dir/some/subDir
  }
)

Returns undefined