JSPM

node-redis-script

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 33948
  • Score
    100M100P100Q142805F
  • License MIT

Easily use redis scripts in Node

Package Exports

  • node-redis-script

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-redis-script) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

redis-script

Easily run redis scripts from Node.

Requirements

Install

npm install node-redis-script

Usage

const redis = require('redis').createClient();

const scriptSrc = 'return KEYS[1]';

// give it a redis client and script source
const echo = createScript(redis, scriptSrc);
// you get back a function that runs your script with given args
// redis requires you to tell it how many arguments to expect
const numArgs = 1;
const result = await echo(numArgs, 'hi');
// Should print 'hi'
console.log(result);

Test

# install docker & docker-compose for local redis setup
npm test