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-buffer-array

v1.1.0

Published

Node-RED node to fill an ring buffer array.

Readme

node-red-contrib-buffer-array

Node-RED node to fill an ring buffer array.

This node fills an array of a given length with payload values.

Motivation

Sometimes it's helpful to buffer some values of a sensor payload stream. This could be the case, if your output device is slower than your sensor data input stream. If you don't want to miss values in between the velocity gap of input and output devices (Nyquist–Shannon sampling theorem), you can use the value buffer to calculate the average of the last few values.

Installation

This package uses ES2015 code. Therefore use at least version 6.4.0 of Node.js.

This package is a node for Node-RED. Install Node-RED

Install this package:

npm install node-red-contrib-buffer-array

... or use the palette manager of the Node-RED ui.

Nodes

buffer-array

Input

payload any

Output

payload array

the buffer array of a given length containing a collection of payloads (added from right to left).

Details

The input payload will be added to the end of the output array. The array has a defined length of items. The first item is the oldest value and the last one is the newest.

If you use numeric values, you'll be able to get the average value of the payloads inside the array. To get the average value, you might attach a standard change node to set a variable with the expression $average(payload). Of course, you might use other expressions like $max(payload) to get the maximum value of the collected payloads, etc.

If you check the option Starting output when buffer filled the node will not output anything until the array is filled completely. I.e. if the buffer array has a length of 6 items, the first 5 node calls will not lead to an output of an buffer array. The 6th call will output the filled buffer array with all 6 items.

Flows

Example flow:

[{"id":"feddb213.294f9","type":"buffer-array","z":"cc8d16aa.a75d28","name":"","bufferLen":"5","startWhenFilled":false,"x":490,"y":160,"wires":[["537c7a24.a841a4","7ccad598.17429c"]]},{"id":"1468aa76.c77d06","type":"random","z":"cc8d16aa.a75d28","name":"","low":"1","high":"10","inte":"true","property":"payload","x":300,"y":160,"wires":[["feddb213.294f9"]]},{"id":"a9da101a.14cf9","type":"inject","z":"cc8d16aa.a75d28","name":"","topic":"test","payload":"Hello!","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":220,"wires":[["feddb213.294f9"]]},{"id":"537c7a24.a841a4","type":"debug","z":"cc8d16aa.a75d28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":670,"y":160,"wires":[]},{"id":"7ccad598.17429c","type":"change","z":"cc8d16aa.a75d28","name":"Get Average","rules":[{"t":"set","p":"payload","pt":"msg","to":"$average(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":200,"wires":[["58fb2cf.d406ad4"]]},{"id":"7ec722b3.ebeedc","type":"inject","z":"cc8d16aa.a75d28","name":"","topic":"random","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":160,"wires":[["1468aa76.c77d06"]]},{"id":"58fb2cf.d406ad4","type":"debug","z":"cc8d16aa.a75d28","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":830,"y":200,"wires":[]}]