Bitmap

BITPOS

Find the position of the first set or clear bit (bit with a value of 1 or 0) in a Redis string key.

Arguments

keybodystringrequired

The key to search in.

bitbody0 | 1required

The key to store the result of the operation in.

startbodynumber

The index to start searching at.

endbodynumber

The index to stop searching at.

Response

integerrequired

The index of the first occurrence of the bit in the string.

Example
 await redis.bitpos("key", 1);
With Range
 await redis.bitpos("key", 1, 5, 20);
Loading search…