Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 6, 2024 via pnpm

temp 0.9.4

Temporary files and directories
Package summary
Share
0
issues
2
licenses
8
ISC
7
MIT
Package created
9 Nov 2010
Version published
10 Nov 2020
Maintainers
2
Total deps
15
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
8 Packages, Including:
fs.realpath@1.0.0
glob@7.2.3
inflight@1.0.6
inherits@2.0.4
minimatch@3.1.2
once@1.4.0
rimraf@2.6.3
wrappy@1.0.2

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
7 Packages, Including:
balanced-match@1.0.2
brace-expansion@1.1.11
concat-map@0.0.1
minimist@1.2.8
mkdirp@0.5.6
path-is-absolute@1.0.1
temp@0.9.4
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of temp 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
mkdirp0.5.62.95 kBMIT
prod
rimraf2.6.35.41 kBISC
prod

Visualizations

Frequently Asked Questions

What does temp do?

The "temp" package is a versatile tool for handling temporary files, directories, and streams in Node.js. It is specially engineered to generate unique file or directory names under the system's temporary directory, change the file mode accordingly, and even provide automatic removal of the temporary entities if needed. This package offers a similar API to the Node.js 'fs' module and is well-suited to the demands of scripts, task runners like Grunt, and even long-running server processes.

How do you use temp?

Utilizing "temp" involves the use of different methods depending on the nature of your task. If you want to create a temporary file, the open or openSync method can be used with optional prefix, suffix, or both. A temporary directory can be created using mkdir or mkdirSync, or you can use path to get a unique name in the system temporary directory. If you want to track the temporary files and directories for automatic cleanup, call the track method. To trigger cleanup at any time, use cleanup or cleanupSync. Below are some examples to illustrate these methods:

For creating and writing to a temporary file and cleaning it up automatically:

var temp = require('temp'),
    fs   = require('fs');

temp.track();

var myData = "sample data";

temp.open('myprefix', function(err, info) {
  fs.write(info.fd, myData, (err) => {
		console.log(err);
	});
  fs.close(info.fd, function(err) {
    // do something with the file
  });
});

For creating a temporary directory:

var temp = require('temp'),
    fs   = require('fs'),
    path = require('path'),

temp.track();

var myData = "Hello World";

temp.mkdir('mydir', function(err, dirPath) {
  fs.writeFile(path.join(dirPath, 'myfile.txt'), myData, function(err) {
    // do something with the file
  });
});

Where are the temp docs?

The documentation for "temp" is encompassed in the package's README content. It provides comprehensive detail about the package's functionalities, methods, affixes handling, and examples to guide you. For more information, you can visit the official GitHub repository at 'http://github.com/bruce/node-temp'. Please make sure to review the examples directory, as it contains working copies of the example usage provided in the readme.