Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
This is just a tool collect for easy use of some tool library. I will pack some operation for more easy to use.
npm install nodeutil
var nu = require('nodeutil');
var log = nu.logger.getInstance(); log.info('Test logger...');
Or you can insert log name to getInstance() to catelogry your log...
var log = nu.logger.getInstance('MAIN_LOG');
var dateutil = no.dateutil; var pattern = 'yyyymmdd hh24:mi:ss'; dateutil.getNowString(pattern); dateutil.getDateString(new Date(), pattern)
var Step = nu.step; Step( function step1(){ //do something... return something1; }, function step2(step1_returned){ //do something return something2; }, ... )
var cfgutil = nu.cfgutil; //read from json file var cfg = cfgutil.readJsonCfg('path to json config file');
var mailer = nu.mailutil;
mailer.init(
{"smtpOptions":{"service":"Gmail", "auth": {"user": "your-account","pass": "your-password"}}, "sender": "NO-REPLY <no-reply@micloud.tw>"}
);
mailer.sendNodeMailAsync('receiver@gmail.com',
'test mail send...',
'send mail OK!',
true,
function(){
console.log('Send mail done...');
}
);
Using mailutil through localhost sendmail service
var mailer = require('nodeutil').mailutil;
mailer.init(
{"smtpOptions":{"host":"localhost"}, "sender": "NO-REPLY <no-reply@micloud.tw>"}
);
mailer.sendNodeMailAsync('yourmail@gmail.com',
'test mail send...',
'send mail OK!',
true,
function(){
console.log('Send mail done...');
}
);
Advance using mailutil...
mailer.init(
{"smtpOptions": {"service":"Gmail",
"auth": {
"user": "your_mail_username", "pass": "your_password"
}},
"sender": "NO-REPLY <no-reply@your.mail.address>"
}
);
mailer.sendNodeMail({
to:["receiver1@gmail.com"],
subject: "test123",
html:"<h1>TEST123</h1>",
cc:["cc-receiver@gmail.com"],
attachments: [//see detail: https://github.com/andris9/Nodemailer#attachment-fields
{ // utf-8 string as an attachment
fileName: "text1.txt",
contents: "hello world!"
},
{ // binary buffer as an attachment
fileName: "text2.txt",
contents: new Buffer("hello world!","utf-8")
}]
},
true, function(res){
console.log(res);
}
);
var json2table = nu.json2table;
var json = [{aaa:123, bbb:223}, {aaa:223, bbb:323}];
console.log(json2table.ConvertJsonToTable(json));
The result:
<table border="1" cellpadding="1" cellspacing="1"><thead><tr><th>aaa</th><th>bbb</th></tr></thead><tbody><tr><td>123</td><td>223</td></tr><tr><td>223</td><td>323</td></tr></tbody></table>
var guid = nu.guid;
//Generate a guid without prefix and postfix
console.log( guid.getGuid('%s%s%s', 0,0));
//Generate a guid with 2 digit prefix and 3 digit postfix
console.log( guid.getSimpleGuid('%s-%s-%s', 2,3));
//Generate a guid using specifc seed
var a = '12341234'
console.log( guid.getSimpleGuidWithSeed(a, '%s-%s-%s', 2,3));
The result:
-13ee608f7e0-
FE-13ee608f7e1-Dia
rm-12341234-eep
FAQs
Node.js Utility
The npm package nodeutil receives a total of 42 weekly downloads. As such, nodeutil popularity was classified as not popular.
We found that nodeutil 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
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.