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

node-red-contrib-posixmq-read

v0.2.0

Published

A Node-RED node that receives messsages form a Posix message queue

Readme

Description

PosixMQ-flow

A node.js library for using POSIX message queues. Originally forked from mscdex/pmq to provide additional customization of flags passed to mq_open(). Subsequently re-written to support v4+ using Native Abstractions for Node.js.

Requirements

  • node.js -- tested against v8+

  • node-red

  • Linux 2.6.6+ or FreeBSD kernel with POSIX message queue support compiled in (CONFIG_POSIX_MQUEUE, which is enabled by default)

  • See man mq_overview for how/where to modify global POSIX message queue resource limits

  • Depends on nan & posix-mq which will be automatically installed when running npm install posixmq-read.

Install

$ npm install posixmq-read

Values

Values

  • msgname - String - name of message queue.

  • maxmsgs - Number - The maximum number of messages in the queue.

  • msgsize - Number - The maximum size of messages in the queue.

Examples

  • Open an existing queue, read all of its messages, and then remove and close it:
var PosixMQ = require('posix-mq');

module.exports = function (RED) {    
 function PosixMQReadNode(config) {
  RED.nodes.createNode(this,config);
  this.msgname = config.msgname;
  this.msgsize = Number(config.msgsize);
  this.maxmsgs = Number(config.maxmsgs);
  var posixmq = new PosixMQ();
  var node = this;
  var msg;
  var n;
 

  var send = false;
  posixmq.open({ name: node.msgname.toString(),create: true,mode: '0777',maxmsgs: node.maxmsgs, msgsize: node.msgsize });
  node.status({fill: "green", shape: "dot", text: node.msgname.toString()});
  node.warn("the " + node.msgname.toString() + " message queue is open");
  readbuf = new Buffer(posixmq.msgsize);
  node.on('input', function() { 
     var str = "";
     while ((n = posixmq.shift(readbuf)) !== false){
      send = true;
      str = str + readbuf.toString('utf8', 0, n);
      };
      if (send){node.send({payload: str})};
      send = false;
  });
  node.on('close', function() { 
    posixmq.unlink();
    posixmq.close();
    node.status({fill: "red", shape: "dot", text: node.msgname.toString()});});
 }
 RED.nodes.registerType("posixmq-read", PosixMQReadNode);
}

API

Events

  • messages() - Emitted every time the queue goes from empty to having at least one message.

  • drain() - Emitted when there is room for at least one message in the queue.

Properties

  • isFull - boolean - Convenience property that returns true if curmsgs === maxmsgs.

  • maxmsgs - integer - The maximum number of messages in the queue.

  • msgsize - integer - The maximum size of messages in the queue.

  • curmsgs - integer - The number of messages currently in the queue.

Methods

  • (constructor)() - Creates and returns a new PosixMQ instance.

  • open(<object>config) - (void) - Connects to a queue. Valid properties in config are:

    • name - string - The name of the queue to open, it MUST start with a '/'.

    • create - boolean - Set to true to create the queue if it doesn't already exist (default is false). The queue will be owned by the user and group of the current process.

    • exclusive - boolean - If creating a queue, set to true if you want to ensure a queue with the given name does not already exist.

    • mode - mixed - If creating a queue, this is the permissions to use. This can be an octal string (e.g. '0777') or an integer.

    • maxmsgs - integer - If creating a queue, this is the maximum number of messages the queue can hold. This value is subject to the system limits in place and defaults to 10.

    • msgsize - integer - If creating a queue, this is the maximum size of each message (in bytes) in the queue. This value is subject to the system limits in place and defaults to 8192 bytes.

    • flags - integer - Default is O_RDWR | O_NONBLOCK (2050). If a different set of flags is required, its integer value may be provided here. See the man page for mq_open for more information.

  • close() - (void) - Disconnects from the queue.

  • unlink() - (void) - Removes the queue from the system.

  • push(< Buffer or string >data[, < integer >priority]) - boolean - Pushes a message with the contents of data onto the queue with the optional priority (defaults to 0). data is either a string or Buffer object. priority is an integer between 0 and 31 inclusive.

  • shift(< Buffer >readbuf[, < boolean >returnTuple]) - mixed - Shifts the next message off the queue and stores it in readbuf. If returnTuple is set to true, an array containing the number of bytes in the shifted message and the message's priority are returned, otherwise just the number of bytes is returned (default). If there was nothing on the queue, false is returned.