Temp File

Path: /src/method/tempfile.coffee compiled to /lib/method/tempfile.js

This will create a new temporary file for you. Like in tempdir() you may give a specific path and prefix before the numeral file part.

Examples

You may get a file back without doing anything:

CoffeeScript Code
fs = require 'alinex-fs' fs.tempfile (err, dir) -> console.log "Temporary file is: " + dir

But don’t forget to remove it if no longer needed.

tempfile()

Usage:tempfile(base, [prefix=process, cb)

Parameter
  • base - String path under which the directory should be created (use null to make it in the os default directory)
  • [prefix=process - String title] to use before numerical part
  • cb - function(<Error>, <String>) callback with Error or the path to the newly created file

tempfileSync()

Usage:tempfileSync({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