
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
mktemp command for node.js
$ npm install mktemp
var mktemp = require('mktemp');
mktemp.createFile('XXXXX.txt', function(err, path) {
if (err) throw err;
// path match a /^[\da-zA-Z]{5}\.txt$/
console.log(path);
});
// return value match a /^[\da-zA-Z]{5}\.tmp$/
mktemp.createFileSync('XXXXX.tmp');
mktemp.createDir('XXXXXXX', function(err, path) {
if (err) throw err;
// path match a /^[\da-zA-Z]{7}$/
console.log(path);
});
// return value match a /^XXX-[\da-zA-Z]{3}$/
mktemp.createDirSync('XXX-XXX');
if support Promise, can use Promise style.
var mktemp = require('mktemp');
mktemp
.createFile('XXXXX.txt')
.then(function(path) {
// path match a /^[\da-zA-Z]{5}\.txt$/
console.log(path);
})
.catch(function(err) {
console.error(err);
});
mktemp
.createDir('XXXXX')
.then(function(path) {
// path match a /^[\da-zA-Z]{5}$/
console.log(path);
})
.catch(function(err) {
console.error(err);
});
mktemp functions are replace to random string from placeholder "X" in template. see example:
mktemp.createFileSync('XXXXXXX'); // match a /^[\da-zA-Z]{7}$/
mktemp.createFileSync('XXX.tmp'); // match a /^[\da-zA-Z]{3}\.tmp$/
mktemp.createFileSync('XXX-XXX'); // match a /^XXX-[\da-zA-Z]{3}$/
template
String
- filename templatecallback
function(err, path)
- callback function
err
: Error|Null
- error objectpath
: String
- pathcreate blank file of unique filename. permission is 0600
.
it throws TypeError if node.js unsupported Promise and callback is not a function.
template
String
- filename templatereturn
String
- pathsync version createFile.
template
String
- dirname templatecallback
function(err, path)
- callback function
err
: Error|Null
- error objectpath
: String
- pathcreate directory of unique dirname. permission is 0700
.
it throws TypeError if node.js unsupported Promise and callback is not a function.
template
String
- dirname templatereturn
String
- pathsync version createDir.
The MIT license.
FAQs
mktemp command for node.js
The npm package mktemp receives a total of 401,476 weekly downloads. As such, mktemp popularity was classified as popular.
We found that mktemp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.