SDK
SDK Javascript v7.x
2

bitpos #

Returns the position of the first bit set to 1 or 0 in a string, or in a substring.

[Redis documentation]

Arguments #

Copied to clipboard!
bitpos(key, bit, [options]);

Arguments Type Description
key
string
Key
bit
integer
Bit to look for.
Accepted values: 0, 1
options
object
Optional query arguments

options #

The options arguments can contain the following option properties:

Property Type (default) Description
end
integer
Search ends at the provided offset
queuable
boolean (true)
If true, queues the request during downtime, until connected to Kuzzle again
start
integer
Search starts at the provided offset

Resolve #

Resolves to the position of the first bit found matching the searched value.

Usage #

Copied to clipboard!
try {
  await kuzzle.ms.set('key', '\x00\x00\x01');
  // Prints: 23
  console.log(await kuzzle.ms.bitpos('key', 1));
} catch (error) {
  console.error(error.message);
}