Skip to content

Instantly share code, notes, and snippets.

@anywhichway
Last active June 30, 2019 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anywhichway/285ee12ebc987410db7b8f01bb73118f to your computer and use it in GitHub Desktop.
Save anywhichway/285ee12ebc987410db7b8f01bb73118f to your computer and use it in GitHub Desktop.
Cloudflare Keys Example
// assume the KV NAMESPACE bound to the Worker is also named NAMESPACE
const db = NAMESPACE.keys = require("keys.js");
let cursor;
do {
const mykeys = await db.keys({cursor});
// by convention, the cursor will be the last element in the key array
cursor = mykeys.pop();
for(const key of mykeys) {
await dosomething(key)
}
while(cursor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment