Skip to content

Tiny javascript and node wrapper for the cloudflare kv-storage rest-api

License

Notifications You must be signed in to change notification settings

markusahlstrand/cloudflare-kv-storage-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cloudflare-kv-storage-rest

Tiny javascript and node wrapper for the cloudflare kv-storage rest-api.

There are a few api-wrappers available on github but so far I haven't found any that supports the new metadata functionality.

The idea with library is to create a wrapper around the the rest api that works exactly as the runtime API (https://developers.cloudflare.com/workers/reference/apis/kv)

Usage in browser

Create an instance of Kv-Storage. The instance will expose the same api as the variable in the runtime API.

Usage in nodejs

To use this is nodejs you can add node-fetch and form-data to the global context:

global.fetch = require('node-fetch');
global.FormData = require('form-data');

Another options is to pass the fetch and form-data shims to the constructor

const fetch = require('node-fetch');
const FormData = require('form-data');

const kvStorage = new KvStorage({
    namespace: 'namespace',
    accountId: 'accountId',
    fetch,
    FormData,
});

About

Tiny javascript and node wrapper for the cloudflare kv-storage rest-api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •