New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@b4dnewz/temp

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@b4dnewz/temp

A node utility to handle temporary files and folders

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

temp

A node utility to handle temporary files and folders

NPM version Build Status Coverage percentage

Getting started

Install the project using your favourite package manager.

npm install @b4dnewz/temp

Load inside your project all together or separate functions.

import * as temp from "@b4dnewz/temp";
// or
import {file, fileSync, dir, dirSync} from "@b4dnewz/temp";

Then create any temporary file you need in your application or your tests.

// create a temporary file
// es: /tmp/e6ba9fff240bde04897f/5fb6aa4e9ac8ccf10e2f
temp.file()

// create a temporary file in sync way
temp.fileSync()

// create a temporary directory
// es: /tmp/3c34454971179fc20e99/29d72d3cb2386b904afe
temp.dir()

// create a temporary directory in sync way
temp.dirSync()
it("should create a temporary file", async () => {
    const tmpFile = await temp.file()
    // do whatever you need with the file
    await tmpFile.remove()
})

Later on, when you have done with it, just release it.

// will remove the temporary file
tmpFile.remove()

// will remove the temporary directory
// even if has content in it
// such as other temporary files
tmpDir.remove()

Documentation

This project provide an online documentation automatically generated with TypeDoc, but a very deep documentation with real world usage examples is coming soon, stay tuned.

Contributing

  • Create an issue and describe your idea
  • Fork the project (https://github.com/b4dnewz/node-temp/fork)
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes with logic (git commit -am 'Add some feature')
  • Publish the branch (git push origin my-new-feature)
  • Add some test for your new feature
  • Create a new Pull Request

License

MIT © Filippo Conti

Keywords

temp

FAQs

Package last updated on 05 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts