Skip to content

Latest commit

 

History

History
73 lines (64 loc) · 3.25 KB

README.md

File metadata and controls

73 lines (64 loc) · 3.25 KB

B2 CDN

Screenshot of a Directory Listing Page

A Cloudflare Worker for serving and browsing content in a private Backblaze B2 bucket.

  • Serve the content in your B2 bucket for free
  • Browse the content in your B2 bucket

Why?

  • Backblaze B2 is cheap file storage
  • Downloading from Backblaze B2 is normally $0.01 per GB
  • Downloading from Backblaze B2 through Cloudflare's CDN is free
  • Private buckets prevent people from downloading from your bucket directly

Setup

Install Wrangler

See Cloudflare's documentation for more information.

wrangler.toml

Copy wrangler.toml.example to wrangler.toml and fill in your own information into the variables. Refer to Cloudflare's documentation for more information.

Secrets

Secrets are like vars but... secret. This Worker only needs one secret named B2SECRET which should contain the applicationKey (the secret part) of your Backblaze B2 application key.

Protected File Listings

You can use Cloudflare Access to require a login for certain subdomains. Let's say you want to publicly share the files in your B2 Bucket, but not allow others to list the files in it, you can set up a separate DIR_DOMAIN and place Cloudflare Access in front of it. There's a lot of supported identity providers. You can make it so only a certain IP can access the directory listing, or only particular Google Accounts.

To Do

  • Implement pagination for enormous folders
  • Implement more efficient calls to b2_list_file_names

License

MIT