npm.io
15.5.0 • Published 6 years ago

@the-/tmp

Licence
MIT
Version
15.5.0
Deps
1
Size
50 kB
Vulns
0
Weekly
0
Stars
5

@the-/tmp

npm Version

Tmp file creator

Installation

$ npm install @the-/tmp --save

Usage

'use strict'

const theTmp = require('@the-/tmp')

async function tryExample() {
  // Create tmp file and clean up automatically
  await theTmp.while(async (filename) => {
    console.log('Generated file', filename)
  })

  // Manually cleanup
  {
    const { cleanup, filename } = await theTmp.generate()
    console.log('Generated file', filename)
    cleanup() // Cleanup the file
  }
}

tryExample().catch((err) => console.error(err))

API Guide

See API Guide for more detail

License

This software is released under the MIT License.

Keywords