Script runner for Redis that loads Lua scripts from the file system, caches them, and executes via EVALSHA with automatic reload on SCRIPT FLUSH. Version 2.2.0 is current, stable, with low release cadence. Designed for use with the node_redis client, it simplifies managing and running Lua scripts in Redis by handling script loading, caching, and error recovery. Differentiator: automatic script caching and re-fetching if scripts are flushed from Redis server.
npm install then-redis-scriptsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize script runner with a redis client and base path, then run a script with keys and args.
Pass 'my-script' instead of 'my-script.lua'.
Use synchronous functions only for shared keys/args calculation.
Use the 'redis' package from npm, not 'ioredis' or 'redis-mock'.
Use `const redisScripts = require('then-redis-scripts');`Ensure the Lua file exists at the resolved path relative to `base`.
Check the Lua script for syntax errors using redis-cli or debug the script.