Package Exports
- create-temp-file
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (create-temp-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
create-temp-file
Creates a temporary file, returns a write stream, a path, and cleanup functions
example
var createTempFile = require('create-temp-file')
var tempFile = createTempFile()
process.stdin.pipe(tempFile)
process.on('exit', tempFile.cleanupSync)
api
var createTempFile = require('create-temp-file')
var ws = createTempFile([ext])
ext
is an optional extension for the temporary file. E.g.'.txt'
- Returns
ws
, a write stream to the new temporary file with the following properties:ws.path
is the absolute path to the temporary file.ws.cleanup([cb])
is a function that will delete the temporary file. Likefs.unlink
. Ifcb
is not provided, errors will be emitted. Dows.on('error', handler)
to handle errors.ws.cleanupSync()
is a function that deletes the temporary file synchronously. Likefs.unlinkSync(path)
. If an error occurs, it will be emitted. Dows.on('error', handler)
to handle errors.
install
With npm do:
npm install create-temp-file