#文件服务器 #fastly #文件上传 #静态站点生成器 #计算 #服务 #视频

应用 compute-file-server-cli

将文件上传到Fastly进行直接服务,支持从Fastly Compute应用程序内直接提供。上传任何类型的文件:图片、文本、视频等,并直接从Fastly提供。非常适合用于由11ty等静态站点生成器构建的文件服务。

2个版本 (1个稳定版)

1.1.0 2023年11月1日
0.0.2-main2023年11月1日

#656 in 文本处理

MIT 许可证

37KB
903

compute-file-server

Fastly文件服务器将文件上传到Fastly,以便从Fastly Compute应用程序内直接提供。

上传任何类型的文件:图片、文本、视频等,并直接从Fastly提供。

非常适合用于由11ty等静态站点生成器构建的文件服务。

安装

npm

通过npm安装预编译的二进制文件

npm install compute-file-server

Cargo

通过cargo编译和安装

git clone https://github.com/JakeChampion/compute-file-server
cd compute-file-server/cli
cargo install --path .

命令

上传

上传文件到Fastly对象存储,如果不存在则创建对象存储。

示例:compute-file-server upload --name website-static-files -- ./folder/of/files

compute-file-server upload
Upload files

Usage: compute-file-server upload [OPTIONS] --name <NAME> -- <PATH>

Arguments:
  <PATH>  

Options:
      --name <NAME>    
      --token <TOKEN>  
  -h, --help           Print help information

将Fastly对象存储连接到Fastly服务。

示例:compute-file-server link --name website-static-files --link-name files --service-id xxyyzz

Usage: compute-file-server link [OPTIONS] --name <NAME> --link-name <LINK_NAME> --service-id <SERVICE_ID>

Options:
      --name <NAME>
      --token <TOKEN>
      --link-name <LINK_NAME>
      --service-id <SERVICE_ID>
  -h, --help                     Print help information

本地

更新fastly.toml以包含包含指定文件的本地对象存储。

示例:compute-file-server local --name files --toml fastly.toml -- ./folder/of/files

Usage: compute-file-server local --toml <TOML> --name <NAME> -- <PATH>

Arguments:
  <PATH>

Options:
      --toml <TOML>
      --name <NAME>
  -h, --help         Print help information

依赖关系

~17–33MB
~560K SLoC