# nijinsky

> Sparse Redis Bitmap in Node.js

Latest version **0.1.1** (published 2017-08-02) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install nijinsky
pnpm add nijinsky
yarn add nijinsky
bun add nijinsky
```

## 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.1.1 |
| Published | 2017-08-02 |
| First published | 2017-08-02 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | expd |
| Maintainers | expd |
| Keywords | redis, bitmap, sparse, analytics |

## Links

- npm: https://www.npmjs.com/package/nijinsky
- Repository: https://github.com/expd/Nijinsky
- Homepage: https://github.com/expd/Nijinsky#readme
- Issues: https://github.com/expd/Nijinsky/issues
- npm.io page: https://npm.io/package/nijinsky

## Dependencies (2)

- [ioredis](https://npm.io/package/ioredis.md) ^3.1.1
- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Recent versions

- 0.1.1 (latest) — 2017-08-02
- 0.1.0 — 2017-08-02

## README

# Nijinsky
Sparse Redis Bitmap in Node.js

## Installation

`npm install nijinsky`

## Overview
Redis is useful for storing bitmaps for analytics purposes. for example, where a key can represent an event and the offset a user id. when user ids are relatively sparse this representation is inefficient. This is a Node.js client side space efficient implementation for some of the operations on bitmaps that redis provides. `getbits` is particuraly useful in case you need all the bits set in a bitmap returned converted to their respective user ids.

## Examples

``` javascript
var redis_sb = new RedisSparseBitmap() // works with local redis

var max_id = 4294967296

random_ids = _.times(10, function() {
    return _.random(max_offset)
  })

var event_id = 'my event id'

redis_sb.setbit(event_id , random_ids[3] , function(err){...}) // can set a single value
redis_sb.setbit(event_id , random_ids , function(err){...}) // can set multiple values

redis_sb.getbit(event_id , random_ids[3] , function(err , value) {...})
redis_sb.bitcount(event_id , function(err,count) { }) // count == random_ids.length

redis_sb.getbits(event_id , function(err , ids) {...}) // ids.sort() equals random_ids.sort()

```

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