基于 Cloudflare Workers 的文件传输加速服务 (File transfer acceleration service)
预览网址:
-
# 图片会直接显示 https://cfile.kkgo.cc/https://kernel.org/theme/images/logos/tux.png # 文件会直接下载 https://cfile.kkgo.cc/https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.18.tar.xz
-
注册 CloudFlare 账号,并且设置 Workers 域名 (比如:
***.workers.dev
) -
安装 Wrangler 命令行工具。
npm install -g wrangler
-
登录
Wrangler
(可能需要扶梯):# 登录,可能登录不成功 wrangler login # 若登录不成功,可能需要使用代理。 # 每个命令行前,均需要加 HTTP_PROXY=http://localhost:20171 (需自行修改) HTTP_PROXY=http://localhost:20171 wrangler login
-
拉取本项目:
git clone https://jihulab.com/devdo/worker-filetas.git
-
修改
wrangler.toml
文件中的name
(filetas)为服务名xxx
(访问域名为:xxx.***.workers.dev
) -
本地测试
npm install npm run dev
-
发布
HTTP_PROXY=http://localhost:20171 wrangler deploy
发布成功将会显示对应的网址
Proxy environment variables detected. We'll use your proxy for fetch requests. ⛅️ wrangler 2.12.2 -------------------- Total Upload: 4.48 KiB / gzip: 1.40 KiB Uploaded xxx (2.20 sec) Published xxx (1.83 sec) https://xxx.***.workers.dev Current Deployment ID: xxxx.xxxx.xxxx.xxxx
# full repository clone
$ git clone --depth 1 https://github.com/cloudflare/workers-sdk
# copy the "worker-typescript" example to "my-project" directory
$ cp -rf workers-sdk/templates/worker-typescript my-project
# setup & begin development
$ cd my-project && npm install && npm run dev
HTTP_PROXY=http://localhost:20171 wrangler deploy