npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bringittocode/mop-js

v1.0.7

Published

This is a mysql library to create long live connection between your application and mysql, this is not mysql pool.

Readme

mop-js

create a long live connection between your application and mysql in a javascript server ( NODEJS ). this is not mysql pool.

this package helps you to manage auto reconnection.

you still have the complete features of mysql in nodejs except for mysql pool

INSTALLATION

npm i @bringittocode/mop-js@latest

FEATURES

  • One library rule them all... i.e you can use any mysql module with this library to manage connection.
  • Auto reconnection if connection timeout or an error occured
  • You still have all the method of any MYSQL module you use except for pool.
  • You have an event to listen on if connection failed or successful

Advantages

  • Mysql concurrent connections remain the same
  • No down time
  • No slow query because connection is alive so no need of creating connection again and again
  • Traffic on mysql database reduces because is only getting connection once.

USAGE

import the module

import mop from "@bringittocode/mop-js";
// Import any mysql module you wish to use
import mysql from "mysql";

//OR
const mop = require('@bringittocode/mop-js');
// Import any mysql module you wish to use
const mysql2 = require("mysql2");

//OR
const {default: mop} = import("@bringittocode/mop-js") //dynamic import
// Import any mysql module you wish to use
const mysql2 = require("mysql2");

Register the module

mop.register({
    DATABASE_INFO: {
        host: "",
        user: "",
        password: "",
        database: "",
    },
    WAIT_TIME: 2000,
    MODULE: mysql //mysql2
});

DATABASE_INFO => your database detailes... you can also put any valid MYSQL initialization option.

WAIT_TIME => how many miliseconds to wait before reconnecting if there is any disconnection.. DEFAULT 5 seconds

MODULE => Any MYSQL module you wish to use.. DEFAULT MYSQL2

After registering you can now import mysql instance in all of your application

what you have to do is to focus on your query as you would if no package is used

CURRENTLY SUPPORTED MODULE.

    const query = "SELECT * FROM your_table where ?";
    mop.DB.query(query, ["user"], function (err, result) {
        try {
            if (err) throw err;
            //manage result
        }
        catch(err)
        {
            //manage error
        }
    });

NOTE :: do not disconnect after you finish... your connection is meant to stay alive so you can query your database at anytime

Event

    // listen for connection and reconnection
    // status => boolean
    mop.DB_INFO.on("connect",(status)=>{
        console.log('database connected');
    });

    // listen for reconnection error
    // code => error code
    // message => error message
    mop.DB_INFO.on("reconnect_error", (code,message) => {
        console.log(code, message);
    });

    // listen for disconnection ...this can be for many reason
    mop.DB_INFO.on("disconnect", (code) => {
        console.log(code);
    });

That all you need. We are finding who can add typescript to this package

feel free to pull request and contribute....

any issue feel free as well.