cloudflare-kv-handler
A Modified version of @cloudflare/kv-asset-handler
, with Non-ASCII URL supported.
Installation
npm uninstall @cloudflare/kv-asset-handlernpm install kv4cf
Usage
Nearly exactly the same as @cloudflare/kv-asset-handler
, so please refer to its README.
Only a few differences need to be noticed:
Use CommonJS instead of ESModule
// What you should do to import @cloudflare/kv-asset-handler // What you should do to import kv4cfconst getAssetFromKV = ;
Custom Error handling
const getAssetFromKV = ;const NotFoundError MethodNotAllowedError InternalError = ; { try return await catch e if e instanceof NotFoundError // ... else if e instanceof MethodNotAllowedError // ... else if e instanceof InternalError // ... else // ... }