Socket
Socket
Sign inDemoInstall

tempfile

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tempfile

Get a random temporary file path


Version published
Maintainers
1
Install size
42.2 kB
Created

Package description

What is tempfile?

The 'tempfile' npm package is used to generate temporary file paths. It is useful for creating temporary files in a secure and predictable manner, which can be particularly helpful in scenarios where you need to store temporary data, such as during testing or when handling file uploads.

What are tempfile's main functionalities?

Generate a temporary file path

This feature allows you to generate a unique temporary file path. The generated path can be used to create a temporary file for various purposes, such as storing temporary data during processing.

const tempfile = require('tempfile');
const tempFilePath = tempfile();
console.log(tempFilePath);

Generate a temporary file path with a specific extension

This feature allows you to generate a temporary file path with a specific file extension. This can be useful when you need the temporary file to have a particular format, such as a text file or an image file.

const tempfile = require('tempfile');
const tempFilePath = tempfile('.txt');
console.log(tempFilePath);

Other packages similar to tempfile

Readme

Source

tempfile Build Status

Get a random temporary file path

Checkout out tempy which is better take on this module.

Install

$ npm install --save tempfile

Usage

const tempfile = require('tempfile');

tempfile('.png');
//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4049f192-43e7-43b2-98d9-094e6760861b.png'

tempfile();
//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/6271e235-13b9-4138-8b9b-ee2f26c09ce3'

API

tempfile([extension])

extension

Type: string

Extension to append to the path.

  • tempy - Get a random temporary file or directory path
  • temp-write - Write string/buffer/stream to a random temp file

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 28 Mar 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc