SDK
SDK Javascript v6.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

bitpos #

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

[Redis documentation]

Arguments #

bitpos(key, bit, [options]);

ArgumentsTypeDescription
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:

PropertyType (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 #

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);
}