Skip to content

backblaze b2 proxy with directory listing and file uploader 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 and authorization
  • Prevent direct bucket access
  • Serve content from B2 bucket for free from Cloudflare's CDN

Demo

maven4.bai.lol

I used this project to host a directory listing for the Maven server for my Minecraft mods. The PUT API is also for easy Maven publishing.

Setup

  1. I'm using asdf to manage Node and PNPM, you can install it or install PNPM yourself
  2. Run curl -L https://bai.lol/b2-worker | bash, the source here
  3. pnpm install
  4. In Backblaze, create a new Application Key, with only access to single bucket
  5. Fill out config/config.ts
  6. You need to also put at least a username and password pair
  7. In Cloudflare Dashboard, create a new KV Namespace
  8. Fill out 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)
  11. git add . && git push to your private repository

TODO

  • File deletion

References