FileShare
Introduction
Share files using Cloudflare Workers and GitHub Private Repositories!
Usage
- Clone this repository
- Create a new GitHub Personal Access Token with the
repo
scope - Create a private repository to store your files
- Create a file named
Secret.ts
in theSource
directory with the following contents:
export const GithubPAT = "ghp_..."; // Your GitHub Personal Access Token
export const GithubOwner = "..."; // Your GitHub username
export const GithubRepo = "..."; // The name of the repository you created
- Make sure you have npm and Wrangler installed and configured
- Create a new Cloudflare Workers project by running
npm create cloudflare@latest
- Create a new D1 Database by running
wrangler d1 create <name>
- Upload file
wrangler.toml
:
name = "..." // Your project name
main = "Source/index.ts"
compatibility_date = "2023-10-02"
[[d1_databases]]
binding = "FileShareBufferDatabase"
database_name = "..." // The name of the database you created
database_id = "..." // The ID of the database you created
- Run
wrangler d1 execute <name> --file=Source/Initial.sql
to initialize the database - Run
npm install
to install dependencies - Run
wrangler deploy
to publish your project - 🎉 Your file share is now live!
License
This project is licensed under the terms of the GNU General Public License v3.0.