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

gudlock

v1.0.1

Published

Centralised lock via TCP socket communication

Downloads

3

Readme

Summary

Add centralised lock support in NodeJS. Underneath, its a simple lock system using TCP communication. Also on Promise. Good luck!

This made to tackles:

  • I can't f$%W! (frankly) use Redis
  • Race condition in concurrent running async tasks
  • Wild access to a resource from multiple node processes
  • Yeah those kind of things

Installation

Install gudlock using the npm package manager:

$ npm install gudlock

User Guide

After deciding up how lock-server is run, using locks is as simple as these:

import { client as gudlock } from 'gudlock'

// A. Prerequisites
// Do this if you set your server in custom host:port
gudlock.attach({ port: 8827, host: '127.0.0.1' })

// B. Using Locks and Releasing
// acquiring lock will return function to release lock
// releasing lock is done by calling returned function

const release = await gudlock.lock()
console.log('important processing is running...')
await release()

Its also possible to give the locks name, so its possible to have >1 lock active in the same time, example:

// specify lock name/identifier on acquire. 
// to release the lock, no need to specify lock's name

const release = await gudlock.lock('LOCK_NAME_HERE')

console.log('important processing is running...')

await release()

Setting up Lock-Server

This will add package called gudlock in your project. There are two options on using this package depending on where you want to run the locks-server:

  1. Run server inside a node app
  2. Run server as separate node app

1. Running server in node app

This method will attach server to process & runtime of another node app (parent app).

PROS: Generally lighter resources consumption. CONS: Lock service will dies when parent node go down.

How to use this method:

// basically include and start listening in node-app's entry point

import { server } from 'gudlock'

server.start({ port: 8827, host: '127.0.0.1' })

console.log(`Lock server running on 127.0.0.1:8827`)

2. Running server as separate node process

This method will start server as individual process & runtime.

PROS: Lock service wont depend on any other node app's state. CONS: Generally bigger resources consumption.

How to use this method:

# run this command 
$ node node_modules/gudlock/bin/server

# to specify custom host:port 
$ node node_modules/gudlock/bin/server --port=7676 --host=128.23.12.3

# this will start a new node process
# default port is 6969 and ip 127.0.0.1

Contributing

Documentation is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit.