Last active
June 30, 2019 14:33
-
-
Save anywhichway/285ee12ebc987410db7b8f01bb73118f to your computer and use it in GitHub Desktop.
Cloudflare Keys Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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