JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1031
  • Score
    100M100P100Q103195F
  • License VOL

Creates a temporary file, returns a write stream, a path, and cleanup functions

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

Build Status Dependency Status devDependency Status

Creates a temporary file, returns a write stream, a path, and cleanup functions

example

var createTempFile = require('create-temp-file')

var ws = createTempFile()
process.stdin.pipe(ws)

process.on('exit', ws.cleanupSync)

api

var createTempFile = require('create-temp-file')

var ws = createTempFile([options])

options

A string or object of options for tempfile2.

  • If it is a string, it is the extension of the temporary file. E.g. '.png'.
  • If it is an object, it can have the following properties:
    • ext is the extension of the temporary file. E.g. '.png'.
    • path is the your own path instead of your system's temporary directory. E.g. 'C:\Users\Joseph.

ws

A write stream to the new temporary file with the following properties:

  • ws.path is the absolute path to the temporary file. E.g. '/tmp/b285e724-226c-11e5-9981-82bd40254040.png'
  • ws.cleanup([cb]) is a function that will delete the temporary file. Like fs.unlink.
  • ws.cleanupSync() is a function that deletes the temporary file synchronously. Like fs.unlinkSync(path).

If an error occurs in ws.cleanup() or ws.cleanupSync(), the error will be emitted.

// In all of these cases, handleErr will be called if there is an error
ws1.cleanup(handleErr)

ws2.on('error', handleErr)
ws2.cleanup()

ws3.on('error', handleErr)
ws3.cleanupSync()

install

With npm do:

npm install create-temp-file

license

VOL