# heroku-redis-tools

> This package allows programmatic access to a heroku redis instance.

Latest version **0.0.2** (published 2018-02-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install heroku-redis-tools
pnpm add heroku-redis-tools
yarn add heroku-redis-tools
bun add heroku-redis-tools
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-02-16 |
| First published | 2018-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 67.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | menubar |

## Links

- npm: https://www.npmjs.com/package/heroku-redis-tools
- npm.io page: https://npm.io/package/heroku-redis-tools

## Dependencies (1)

- [execa](https://npm.io/package/execa.md) ^0.9.0

## Recent versions

- 0.0.2 (latest) — 2018-02-16
- 0.0.1 — 2018-02-16

## README

## heroku-redis-tools

This package allows programmatic access to a heroku redis instance.

## Installation

```bash
npm install --save heroku-redis-tools
```

## Usage

herokuRedis(commands, [params]) => promise
```js
params: {
  apiKey: 'HEROKU_API_KEY',
  app: 'HEROKU_APP_NAME'
}
```

`commands` can be a string (for a single command) or array of commands, e.g., `['KEYS *', 'FLUSHALL']` or `'FLUSHALL'`.

## Auth

Either set process.env.HEROKU_API_KEY or pass your key as a param { apiKey: 'xxxxx' } 

You can retrieve your heroku auth token by running:

```bash
heroku login # login if necessary
heroku auth:token
```

## Examples

### Flush all keys (`FLUSHALL`)

```js
herokuRedis('MGET "sess:Lx8m6efID7ZZFrFPhajmk_b9LItkyLgs"', { app: 'menubar-dev' })
```

### Get a value (`MGET key`)

```js
const herokuRedis = require('heroku-redis-tools')

herokuRedis('MGET "sess:Lx8m6efID7ZZFrFPhajmk_b9LItkyLgs"', { app: 'menubar-dev' }).then(resp => {
  console.log(resp)

  => ['{"cookie":{"originalMaxAge":604800000,"expires":"2018-02-23T10:31:25.443Z","httpOnly":true,"path":"/"}}']
})
```

### List all keys (`KEYS *`)

```js
const herokuRedis = require('heroku-redis-tools')

herokuRedis('KEYS *', { app: 'menubar-dev' }).then(resp => {
  console.log(resp)
  => [
      'sess:vgvS5fgrE8XarmvI8xHpnngr1fgzYxRo',
      'sess:MBYSqShSbh58bsq6ipDj4S3ZbPf0ePhj',
      ...
    ]
})
```

---
_Source: https://npm.io/package/heroku-redis-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
