
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
mysql-events
Advanced tools
A node.js package that watches a MySQL database and runs callbacks on matched events like updates on tables and/or specific columns.
A Node JS NPM package that watches a MySQL database and runs callbacks on matched events.
This package is based on the ZongJi node module. Please make sure that you meet the requirements described at ZongJi, like MySQL binlog etc.
#Quick Start
var MySQLEvents = require('mysql-events');
var dsn = {
host: _dbhostname_,
user: _dbusername_,
password: _dbpassword_,
};
var mysqlEventWatcher = MySQLEvents(dsn);
var watcher =mysqlEventWatcher.add(
'myDB.table.field.value',
function (oldRow, newRow, event) {
//row inserted
if (oldRow === null) {
//insert code goes here
}
//row deleted
if (newRow === null) {
//delete code goes here
}
//row updated
if (oldRow !== null && newRow !== null) {
//update code goes here
}
//detailed event information
//console.log(event)
},
'match this string or regex'
);
#Installation
npm install mysql-events
#Usage
var MySQLEvents = require('mysql-events');
var dsn = {
host: 'localhost',
user: 'username',
password: 'password'
};
var myCon = MySQLEvents(dsn);
Make sure the database user has the privilege to read the binlog on database that you want to watch on.
var event1 = myCon.add(
'dbName.tableName.fieldName.value',
function (oldRow, newRow, event) {
//code goes here
},
'Active'
);
This will listen to any change in the fieldName and if the changed value is equal to Active, then triggers the callback. Passing it 2 arguments. Argument value depends on the event.
###rowObject It has the following structure:
{
database: dbName,
table: tableName,
affectedColumns: {
[{
name: fieldName1,
charset: String,
type: Number
metedata: String
},{
name: fieldName2,
charset: String,
type: Number
metedata: String
}]
},{
changedColumns: [fieldName1, fieldName2],
fields: {
fieldName1: recordValue1,
fieldName2: recordValue2,
....
....
....
fieldNameN: recordValueN
}
}
##Remove an event
event1.remove();
##Stop all events on the connection
myCon.stop();
##Additional options In order to customize the connection options, you can provide your own settings passing a second argument object to the connection function.
var mysqlEventWatcher = MySQLEvents(dsn, {
startAtEnd: false // it overrides default value "true"
});
You can find the list of the available options here.
#Watcher Setup Its basically a dot '.' seperated string. It can have the following combinations
#LICENSE MIT
FAQs
A node.js package that watches a MySQL database and runs callbacks on matched events like updates on tables and/or specific columns.
The npm package mysql-events receives a total of 59 weekly downloads. As such, mysql-events popularity was classified as not popular.
We found that mysql-events demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.