Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

temp-write

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

temp-write

Write data to a random temporary file

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
466K
decreased by-26.94%
Maintainers
1
Weekly downloads
 
Created

What is temp-write?

The temp-write npm package allows you to write temporary files to the filesystem. It is useful for scenarios where you need to create temporary files that are automatically cleaned up after use.

What are temp-write's main functionalities?

Write temporary file with content

This feature allows you to write a string to a temporary file and get the file path. The file is automatically cleaned up after the process exits.

const tempWrite = require('temp-write');
const fs = require('fs');

(async () => {
  const filePath = await tempWrite('Hello, world!');
  console.log(filePath);
  console.log(fs.readFileSync(filePath, 'utf8'));
})();

Write temporary file with specific extension

This feature allows you to specify the extension of the temporary file. The file is automatically cleaned up after the process exits.

const tempWrite = require('temp-write');
const fs = require('fs');

(async () => {
  const filePath = await tempWrite('Hello, world!', { extension: 'txt' });
  console.log(filePath);
  console.log(fs.readFileSync(filePath, 'utf8'));
})();

Write temporary file with specific name

This feature allows you to specify the name of the temporary file. The file is automatically cleaned up after the process exits.

const tempWrite = require('temp-write');
const fs = require('fs');

(async () => {
  const filePath = await tempWrite('Hello, world!', { name: 'example.txt' });
  console.log(filePath);
  console.log(fs.readFileSync(filePath, 'utf8'));
})();

Other packages similar to temp-write

Keywords

FAQs

Package last updated on 26 Jul 2024

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