Skip to content

backblaze b2 frontend via cloudflare worker

License

Notifications You must be signed in to change notification settings

badasintended/b2-worker

Repository files navigation

B2 Worker

B2 Worker is a front-end for private Backblaze B2 storage using Cloudflare Worker.

Features

  • Directory Listing
  • File upload API via PUT method
  • File uploader form at /uploader
  • Basic authentication
  • Prevent direct bucket access
  • Serve content from B2 bucket for free from Cloudflare's CDN

Setup

  1. I'm using asdf to manage Node and PNPM, you can install it or install PNPM yourself
  2. Clone the repository
  3. pnpm install
  4. In Backblaze, create a new Application Key, with only access to single bucket
  5. Copy config/private.example.ts to config/private.ts, copy the keys into it
  6. You need to also put at least a username and password pair
  7. In Cloudflare Dashboard, create a new KV Namespace
  8. Copy wrangler.example.toml to wrangler.toml, copy the KV id there
  9. pnpm run deploy
  10. Add custom domain to the worker and disable the workers.dev route (to enable response caching)

TODO

  • File deletion

References