Socket
Socket
Sign inDemoInstall

@types/tmp

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/tmp

TypeScript definitions for tmp


Version published
Weekly downloads
2.3M
increased by8.21%
Maintainers
1
Weekly downloads
 
Created

What is @types/tmp?

@types/tmp provides TypeScript type definitions for the 'tmp' npm package, which is used to create temporary files and directories in a Node.js environment.

What are @types/tmp's main functionalities?

Create a Temporary File

This feature allows you to create a temporary file. The callback provides the file path, file descriptor, and a cleanup callback to remove the file when done.

const tmp = require('tmp');
tmp.file((err, path, fd, cleanupCallback) => {
  if (err) throw err;
  console.log('File: ', path);
  console.log('Filedescriptor: ', fd);
  cleanupCallback();
});

Create a Temporary Directory

This feature allows you to create a temporary directory. The callback provides the directory path and a cleanup callback to remove the directory when done.

const tmp = require('tmp');
tmp.dir((err, path, cleanupCallback) => {
  if (err) throw err;
  console.log('Dir: ', path);
  cleanupCallback();
});

Synchronous File Creation

This feature allows you to create a temporary file synchronously. The method returns an object with the file path and a remove callback.

const tmp = require('tmp');
const tmpobj = tmp.fileSync();
console.log('File: ', tmpobj.name);
tmpobj.removeCallback();

Synchronous Directory Creation

This feature allows you to create a temporary directory synchronously. The method returns an object with the directory path and a remove callback.

const tmp = require('tmp');
const tmpobj = tmp.dirSync();
console.log('Dir: ', tmpobj.name);
tmpobj.removeCallback();

Other packages similar to @types/tmp

FAQs

Package last updated on 04 May 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc