Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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
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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.