Skip to content

history-lab/historylab-docviewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R2 Text File Viewer

A simple Cloudflare Worker that serves text files from an R2 bucket based on the URL path.

Features

  • View text files directly from your R2 bucket
  • Simple URL-based access (e.g., /path/to/your/file.txt)
  • Minimal and efficient implementation

Setup

  1. Install dependencies:

    npm install
  2. Configure your R2 bucket: Make sure you have created an R2 bucket named ramus-files in your Cloudflare account.

    If you need to use a different bucket name, update the bucket_name in wrangler.jsonc.

  3. Local development:

    npm run dev
  4. Deploy to Cloudflare:

    npm run deploy

Usage

Once deployed, access your files using:

https://r2-text-viewer.your-subdomain.workers.dev/path/to/file.txt

The worker will display the text content of the file if it exists, or appropriate error messages if the file isn't found.

Limitations

  • Currently only supports text files
  • No authentication or authorization mechanisms
  • No caching configuration

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published