{"_id":"@makerbot/redis-scan","_rev":"50-c45e561bf1f477b0d09e5a9a44ff8956","name":"@makerbot/redis-scan","description":"A simple ES6 Redis key scanner for Node","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.3":{"name":"@makerbot/redis-scan","version":"1.0.3","keywords":["redis","scan","scanner"],"author":{"name":"GigSalad"},"license":"Apache-2.0","_id":"@makerbot/redis-scan@1.0.3","maintainers":[{"name":"jaffrepaul","email":"paul.jaffre@makerbot.com"},{"name":"tjhorner","email":"me@tjhorner.com"},{"name":"wenson.tsai","email":"wenson.tsai@makerbot.com"},{"name":"ray.cheng","email":"ray.cheng@makerbot.com"},{"name":"leorfree","email":"leor.freedman@makerbot.com"},{"name":"thejaysun","email":"jsun1650@gmail.com"},{"name":"blaw023","email":"branden.lawrence@makerbot.com"},{"name":"stevecormier","email":"stephen.cormier@makerbot.com"},{"name":"mbdevops","email":"stephen.cormier@makerbot.com"}],"homepage":"https://github.com/makerbot/node-redis-scan#readme","bugs":{"url":"https://github.com/makerbot/node-redis-scan/issues"},"dist":{"shasum":"5a778dbcb2043320f7c146b19f8c5b74558f8328","tarball":"https://registry.npmjs.org/@makerbot/redis-scan/-/redis-scan-1.0.3.tgz","fileCount":5,"integrity":"sha512-QUXQcd6KmpbXlxmI6Udv2zcaTCVwzboV4CqBSdxXxjG12uUoRcfN4pyR0wAqM8PGcX/ic+zBqLg+sq2Ox4AVew==","signatures":[{"sig":"MEYCIQDlc3uvsE4NITGnKOsWdmdD/ohOE2LmYkP8nicQOaAuDwIhAPqcsyZUnkON0h/WcpzN6kBQGcjTY29Fz1hyqQ0SCRX/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21980,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdshvOCRA9TVsSAnZWagAAw2AP/1UM0bRCEGLzL+IfELse\nRiSvvPSVf+moWYi/vA0h+/+Dx+izgriBBD7KmMg6CY+g+amvhT86Chc1qrcs\nwlL8ZPyCaL4PpxgZ6bnsB/54ACYC8mQfKVS480+hD2ufgw07y+hG8bv7AYpF\nybO5XOiBN1Kpfg1YZ5bagzJkA3R4SST6DXx7kAWuPEV8zNnPXJZlm/G/SI12\ntKn5v6XGq9TfvFlougPLJ9xUVa3AR3BInp5HWkIpYihF40g93kJk53oeghPa\nQzqP1eo/y0QqGZNLcvQjSh2ihdwgazXvffgdSs0jXbi45oX1C9mdCsk4vgBo\nmkV3w2OyC7AK1MergIfl74Zsa30mVx9jGcHd4u7wbKRhRdCdCxaAUDmVWo+8\n0FbAKrydRlCqq6YDQtLHDGRzGuctDmAD/ICgzVBlnFCirsM1SI9IeYeGKIm5\nt6iZn5lXVu6ig8S6n48RU+vpMMWiwHsAxf+xU4dr/3B/j/u6fLtCeNM6f2nx\nH/0MChsA6DWZc3/mC7R6t3R7mhD6BumOJq2n70+RUkOgQLX81DzOXE0cC+++\nkBASyo8G+FFd66jKdVaRvOZRTrFhiQPBDML+EHfg7LN8RHsM9eJ0yz8bfHRz\nZISS11biv5S5Hn6FmGD4xrnCDnPSaOV6h+wCwVNDp71tWKSuBnuS5oQJIHsP\n8ltk\r\n=1Ldl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"redis-scan.js","engines":{"node":">= 8.0.0"},"gitHead":"d8ac79eb32b2dd2a0ed14b1695981bf019edec88","scripts":{"test":"nyc mocha"},"_npmUser":{"name":"tjhorner","email":"me@tjhorner.com"},"repository":{"url":"git+https://github.com/makerbot/node-redis-scan.git","type":"git"},"_npmVersion":"6.10.2","description":"A simple ES6 Redis key scanner for Node","directories":{},"_nodeVersion":"8.16.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.0.0","uuid":"^3.3.2","mocha":"^6.0.0","redis":"^2.8.0"},"_npmOperationalInternal":{"tmp":"tmp/redis-scan_1.0.3_1571953613568_0.18356189923722188","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"@makerbot/redis-scan","version":"1.0.4","keywords":["redis","scan","scanner"],"author":{"name":"GigSalad"},"license":"Apache-2.0","_id":"@makerbot/redis-scan@1.0.4","maintainers":[{"name":"blaw023","email":"branden.lawrence@makerbot.com"},{"name":"jaffrepaul","email":"paul.jaffre@makerbot.com"},{"name":"leorfree","email":"leor.freedman@makerbot.com"},{"name":"mbdevops","email":"stephen.cormier@makerbot.com"},{"name":"ray.cheng","email":"ray.cheng@makerbot.com"},{"name":"stevecormier","email":"stephen.cormier@makerbot.com"},{"name":"thejaysun","email":"jsun1650@gmail.com"},{"name":"tjhorner","email":"me@tjhorner.com"},{"name":"wenson.tsai","email":"wenson.tsai@makerbot.com"}],"homepage":"https://github.com/makerbot/node-redis-scan#readme","bugs":{"url":"https://github.com/makerbot/node-redis-scan/issues"},"dist":{"shasum":"2e87c4f5e1da51a0d76ed6b0d177f9e7b9fc24b1","tarball":"https://registry.npmjs.org/@makerbot/redis-scan/-/redis-scan-1.0.4.tgz","fileCount":5,"integrity":"sha512-t2euKmJAngRDbOlHdSgrTRJO+2ZiS3FAK8tXNXJdX1dpiilV6bCqcX4dt3XE4vp22WjDyMJYUFhsMajMMM1hXA==","signatures":[{"sig":"MEQCIEgFjTjrTTmr+CZXOPMmGzE8KTXckLmQPAEyIwlS5I7GAiBi9mi+6oO/hyoIG5lPWyfoIUG0NhxoMElLjYdON7IZ4w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22099,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdsinvCRA9TVsSAnZWagAACscQAI31IDP8zhmQ4qt1o4z0\nqKRevt1yfkVOoznEtGUHqd3rT+5Uiq4NhJL6oS77pmzlfmXP/9XEJokCyPb+\nzzWbDwnK2xjw7gO/VvhZ6ZjmETMM7c1tZxoOTUscN7FZP9n2zyp+IWyY2Y2E\nuKQurSyYLtbaNdKhn5bx1Wn02mE6/vGAn1Xp4S4MOyJcwX37zHOl2UUDxa3+\nYVycfLARe3G4fqpFqcCsxasoxaTcgoiNLpXDYo3EqieWw3PS1+yPAVVqaQR6\nkkwaIRLWueTA+5FjJTP9W5HHhRtdgX6PTBPoGqjentvgf5fGGj4HmL1mG25M\nr2VAHYWZ+Ig0b6B8ZPLTttDXQ1RlMcu2k2I2vrmODmPJUr/tn/8ncrsTYvUS\nK8vT0DzoFVxVqTAybe95Ypyzc9u5Q/kL7/PSrDaoqNEmWaB7t7GGff842CA4\n1URnc2dVdGkF1z6Z0vsic4HU+30WqHSkoDNRJIj2SB9ZUKqvqc6NUkUCk0f9\nw+pbC9e75SAw3kIf/esFC0Wwl95KnXcJ9XpC/N242mtzudRmqHKExUnYVFrF\nNbqwDuntVFOWST58bTQwR6BZXFhv8N1tr6rFUWVuUf5l06hTyxap7ZuRxu0b\ntCBDx5p0oibQZgGsG++IZtBODEYwUT18gl3pJAK1Fj4qfUnI2hhweznW/bn0\nB+uo\r\n=K2Ff\r\n-----END PGP SIGNATURE-----\r\n"},"main":"redis-scan.js","engines":{"node":">= 8.0.0"},"gitHead":"786593de275aa73ae2342f2f0cd4685336c92501","scripts":{"test":"nyc mocha"},"_npmUser":{"name":"tjhorner","email":"me@tjhorner.com"},"repository":{"url":"git+https://github.com/makerbot/node-redis-scan.git","type":"git"},"_npmVersion":"6.10.2","description":"A simple ES6 Redis key scanner for Node","directories":{},"_nodeVersion":"8.16.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.0.0","uuid":"^3.3.2","mocha":"^6.0.0","redis":"^2.8.0"},"_npmOperationalInternal":{"tmp":"tmp/redis-scan_1.0.4_1571957231047_0.30319813575834376","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-10-24T21:46:53.568Z","modified":"2024-05-30T12:04:44.461Z","1.0.3":"2019-10-24T21:46:53.722Z","1.0.4":"2019-10-24T22:47:11.275Z"},"maintainers":[{"email":"craig.king@ultimaker.com","name":"craig-ultimaker"},{"email":"devops+npmjs@makerbot.com","name":"mbdevops"}],"author":{"name":"GigSalad"},"repository":{"url":"git+https://github.com/makerbot/node-redis-scan.git","type":"git"},"keywords":["redis","scan","scanner"],"license":"Apache-2.0","homepage":"https://github.com/makerbot/node-redis-scan#readme","bugs":{"url":"https://github.com/makerbot/node-redis-scan/issues"},"readme":"# Node Redis key scanner\n\n**Adds support for cancellation. Based off the [library by GigSalad](https://github.com/GigSalad/node-redis-scan).**\n\nA simple ES6 Redis key scanner for Node 8 and newer. This is a small class that allows you to do one thing quickly and easily: scan a Redis keyspace for a given pattern.\n\nSee the [Redis SCAN command documentation](https://redis.io/commands/scan) for information about how to write patterns for matching, the guarantees, caveats, etc.\n\n# Install\n\n```\nyarn add node-redis-scan\n```\n\n# Use\n\nInstantiate this class with a [Node Redis client](https://github.com/NodeRedis/node_redis) and then perform keyspace scans in one of two ways...\n\n### The `scan()` method\n\nThe `scan()` method provides the easiest way to scan your keyspace with a single callback that will be passed all matching keys. Depending on the size of your keyspace (millions of keys and beyond) this process might take many seconds or longer.\n\n**Parameters**\n\n|Name|Type|Description|\n|-|-|-|\n|`pattern`|string|The Redis glob-style string pattern to match keys against.|\n|`callback`|function|Invoked with (err, matchingKeys).|\n\n**Example**\n\n```js\nconst redis = require('redis');\nconst redisScan = require('node-redis-scan');\n\nconst client = redis.createClient();\nconst scanner = new redisScan(client);\n\nscanner.scan('some-pattern*', (err, matchingKeys) => {\n    if (err) throw(err);\n\n    // matchingKeys will be an array of strings if matches were found\n    // otherwise it will be an empty array.\n    console.log(matchingKeys);\n});\n```\n\n### The `eachScan()` method\n\nThe `eachScan()` method is useful if you want to perform work with matched keys at the same time as the keyspace is being scanned. When you’re scanning an enormous keyspace this is likely a more efficient way to operate: you can begin handling matched keys asynchronously, before the scan has finished. Unfortunately this approach doesn’t help in situations where you need to have every matching key prior to performing the next step in your operation/application.\n\nMatching keys are passed to the intermediate callback function after each iteration of the Redis `SCAN` command. The final callback is passed a count of how many matching keys were returned.\n\n**Parameters**\n\n|Name|Type|Description|\n|-|-|-|\n|`pattern`|string|The Redis glob-style string pattern to match keys against.|\n|`eachScanCallback`|function|Invoked with (matchingKeys). If this returns `true` (NOT truthy), the scan will be cancelled. Useful if you only want to scan until a key is found.|\n|`callback`|function|Invoked with (err, matchCount).|\n\n**Example**\n\n```js\nconst redis = require('redis');\nconst redisScan = require('node-redis-scan');\n\nconst client = redis.createClient();\nconst scanner = new redisScan(client);\n\nscanner.eachScan('some-pattern*', (matchingKeys) => {\n    // Depending on the pattern being scanned for, many or most calls to\n    // this function will be passed an empty array.\n    if (matchingKeys.length) {\n        // matchingKeys found after this iteration of the SCAN command.\n        console.log(matchingKeys);\n    }\n}, (err, matchCount) => {\n    if (err) throw(err);\n\n    // matchCount will be an integer count of how many total keys\n    // were found and passed to the intermediate callback.\n    console.log(`Found ${matchCount} keys.`);\n});\n```\n\n# Test\n\nTests are run via [Istanbul](https://github.com/istanbuljs/nyc) and [Mocha](https://github.com/mochajs/mocha). Clone the project then run:\n\n```\nyarn test\n```\n\n# Contribute\n\nSimply open an issue or send a pull request. Not sure how to do that? Check out [Github’s fast and free course on how to contribute to a project](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).\n\n# License\n\nLicensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).\n","readmeFilename":"README.md"}