Utility Nodes for Node-RED
@rosepetal/node-red-contrib-utils provides 9 utility nodes for array assembly, message queueing, rate limiting, file saving, promise aggregation, safe debugging, and event loop monitoring.

Installation
bash
cd ~/.node-red
npm install @rosepetal/node-red-contrib-utilsOr search @rosepetal/node-red-contrib-utils in the Node-RED Palette Manager.
Requirements
- Node.js 18.17 or later (
package.jsondeclares>=16.0, but thesharpversion the package depends on, 0.34, needs^18.17.0 || ^20.3.0 || >=21.0.0) - Node-RED >= 1.0.0
sharpnative addon (fetched via npm)
Nodes
All node types are prefixed with rp- and appear under the RP Utils category in the editor.
I/O and Array Tools
| Node | Purpose |
|---|---|
| rp-array-in | Tag incoming data with a position index for ordered array assembly |
| rp-array-out | Collect indexed data into ordered arrays with timeout handling |
| rp-array-select | Select array elements using index and slice syntax |
| rp-queue | Buffer messages, enforce output intervals, drop stale or overflow items |
| rp-save-file | Save payloads to disk as image (JPEG, PNG, WebP, BMP), JSON, text, or binary |
| rp-rate-limit | Enforce minimum interval between outputs based on external timestamps |
Async and Workflow
| Node | Purpose |
|---|---|
| rp-promise-reader | Resolve arrays of promises, merge results, and record timing |
Utilities
| Node | Purpose |
|---|---|
| rp-clean-debug | Debug output that sanitizes large payloads to keep the sidebar responsive |
| rp-block-detect | Event loop delay watchdog with live status and log warnings |
Non-blocking by design
The nodes keep heavy work off the Node-RED event loop:
- Filesystem access uses
fs.promisesand streams. - Image encoding runs on Sharp's thread pool. Pixel work written in JavaScript (BGR/RGB reordering, raw BMP and PNG encoding) runs on a small worker-thread pool: one worker kept warm, up to
min(4, cores - 1), or the number set in theRP_CPU_WORKERSenvironment variable. See rp-save-file. flow/globalcontext is read and written through Node-RED's asynchronous context API, so asynchronous context stores are supported.- Debug sanitisation is bounded (depth, key, array and string-sample limits) and never deep-clones the message. See rp-clean-debug.
- rp-block-detect watches the event loop and logs a warning when something blocks it.