mktemp
command for Node.js
npm install fs-mktemp
prefix
<String>
callback
<Function>
const { mktempDir } = require('fs-mktemp');
mktempDir((err, dir) => {
if (err) {
return console.error(err);
}
console.log(dir);
});
mktempDir()
.then(dir => {
console.log(dir);
})
.catch(err => {
console.error(err);
});
prefix
<String>
const { mktempDirSync } = require('fs-mktemp');
console.log(mktempDirSync());
options
<Object>
options.content
<String>
options.prefix
<String>
callback
<Function>
- or -
prefix
<String>
callback
<Function>
const { mktempFile } = require('fs-mktemp');
mktempFile((err, file) => {
if (err) {
return console.error(err);
}
console.log(file);
});
mktempFile()
.then(file => {
console.log(file);
})
.catch(err => {
console.error(err);
});
options
<Object>
options.content
<String>
options.prefix
<String>
- or -
prefix
<String>
const { mktempFileSync } = require('fs-mktemp');
console.log(mktempFileSync());