Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
DB pool wrapper for node.js This module is used to share a mysql/mariadb pool of connections between modules, classes, files etc.
It also logs with winston if there is a database error, so you do not need to fetch the database error manually each time.
npm i larvitdb
The module must first be required and then configured. Make this in your main application file:
var db = require('larvitdb');
db.setup(
{
"connectionLimit": 10,
"socketPath": "/var/run/mysqld/mysqld.sock",
"user": "foo",
"password": "bar",
"charset": "utf8_general_ci",
"supportBigNumbers": true,
"database": "my_database_name"
}
);
See a full list of possible options here. Then you can just require the module in your other files for usage, like this:
A direct query
var db = require('larvitdb');
db.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
console.log('dbmodel: The solution is: ', rows[0].solution);
});
Or, if a connection is needed:
var db = require('larvitdb');
db.getConnection(function(err, dbCon) {
var sql = 'SELECT * FROM users WHERE username LIKE ' +
dbCon.escape(postData);
dbCon.query(sql, function(err, rows) {
dbCon.release(); // Always release your connection when the query is done
if (err)
throw err;
You dont need to get a connection to escape though. You can do like this:
var db = require('larvitdb');
db.query('SELECT * FROM users WHERE id = ?', [userId], function(err, results) {
// ...
});
FAQs
DB wrapper module for node.js
The npm package larvitdb receives a total of 968 weekly downloads. As such, larvitdb popularity was classified as not popular.
We found that larvitdb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.