Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Rename files using some transformers.
NOTE: Rename < 0.2.0 is not the same lib, you can see renamer. 1.0.0 have a big change.
$ npm install rename -g
Rename file using another filepath.
rename('a.js', 'b.js');
// => b.js
Rename file using a transform object that contain some property.
{
dirname: "replace dirname",
prefix: "add prefix before basename",
basename: "replace dirname",
suffix: "add prefix after basename",
extname: "replace extname"
}
Add -debug
suffix
rename('a.js', {suffix: '-debug'});
// => a-debug.js
Also can use a transform function that could return a transform object.
rename('a.js', function() {
return {suffix: '-debug'};
});
// => a-debug.js
Filepath can be a string or object. Parse the filepath to file object if it's a string.
File object should contain property dirname, basename and extname.
rename({
basename: 'a',
extname: '.js'
}, 'b.js');
// => b.js
Transformer can be a function, string or object.
Simple example about transform function using custom property.
function transformer(fileObj) {
return {
suffix: fileObj.hash || '-debug'
};
}
rename({
basename: 'a',
extname: '.js'
}, transformer);
// => a-debug.js
rename({
basename: 'a',
extname: '.js',
hash: '-123'
}, transformer);
// => a-123.js
The value of transform object can be template that parsed from file object.
rename({
basename: 'c',
extname: '.js',
hash: '111'
}, {
suffix: '-${hash}',
}).should.eql('c-111.js');
Generate a file object from a string or object.
Generate a filepath from file object.
Copyright (c) 2017 popomore. Licensed under the MIT license.
FAQs
Rename files using some transformers.
The npm package rename receives a total of 13,276 weekly downloads. As such, rename popularity was classified as popular.
We found that rename demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.