Download KV record in bulk

Any way to download kv store record in bulk? I mean save as a local file.
2 Replies
James
James15mo ago
There’s no automatic way that I know of, no. You would need to iterate over and read every key in your KV namespace.
mattp
mattpOP15mo ago
My workaround: Add a fetch handler which will list all kv records and return as a application/json response. @James Is there a way to have fetch handler only on local development? Something like:
export default {
...(ENV === 'development' && {
fetch: myHandler,
})
}
export default {
...(ENV === 'development' && {
fetch: myHandler,
})
}
I want to have a helper function which can interact with KV/R2 only on local development, so I don't have to comment out the fetch handler before I deploy to prod.
Want results from more Discord servers?
Add your server