# Send S3
跨平台的对象存储上传工具
- 支持 Windows、Linux、MacOS
- 可以用于图片上传(图床)、文件分享等
- 带有日志记录功能,可以查看上传历史
- 支持通过系统自带的工具快速上传文件(Windows:「发送到」;MacOS:「快捷指令」)
## 安装
我们推荐使用 [pipx](https://pypa.github.io/pipx/) 安装 Send S3,请参见其官网来安装 pipx。
```bash
# 安装方法 1:使用 pipx 安装 (推荐)
pipx install send-s3
# 安装方法 2:使用 pip 安装
pip3 install send-s3
```
## 使用
安装完成后,请运行初始化命令:
```bash
send-s3 init
```
初始化命令会创建应用目录:
- Windows:`%APPDATA%\send-s3`
- MacOS / Linux:`$XDG_CONFIG_HOME/.config/send-s3` 或 `~/.config/send-s3`
请确保 `config.toml` 文件存在于应用目录中,且 `secret-id`、`secret-key`、`bucket`、`region` 等参数已经配置正确,否则无法上传文件。
如果输入 `send-s3 init` 后提示找不到命令,可能是 PATH 环境变量没有生效或没有配置,请依次检查:
- 重新启动当前 shell,如 `exec zsh` 或 `exec bash`
- 重新启动当前终端,在 GUI 下应退出终端应用(iTerm2 下按 <kbd>Command ⌘</kbd> + <kbd>Q</kbd>、Windows Terminal 下关闭窗口)
- 查看 PATH 变量
- 使用 pipx,需要根据 pipx 的提示将 `~/.local/bin` 添加到 PATH
- Windows 版的 Python 默认不会将 `Scripts` 添加到 PATH,需要手动添加。打开 [设置——系统——关于](ms-settings:about) 点击右侧「高级系统设置」,添加 `C:\Users\<用户名>\AppData\Roaming\Python\<Python版本>\Scripts` 到 PATH
- 如果使用了手动创建虚拟环境安装(安装方法 3),请将 `~/.cos-uploader/bin` 添加到 PATH
配置完成后,可以使用 `cos-uploader` 命令来上传文件。
```bash
# 上传文件试试,测试配置是否正确
echo "Hello World" > hello.txt
send-s3 upload hello.txt
```
### Windows 平台功能
在运行 `send-s3 init` 后,会在「资源管理器」中添加「发送到」菜单项,可以在「资源管理器」中右键文件,然后选择「发送到」,再选择「Send S3」来上传文件。
### MacOS 平台功能
请导入 [Send S3 快捷指令](https://www.icloud.com/shortcuts/b84eab4b8df141d89a25f048047ea4ff)
导入完成后,请打开「快捷指令」App,选择左上角菜单中的「快捷指令——设置——高级」,勾选「允许运行脚本」。
配置完成 `config.toml` 后,在 Finder 中右键想要上传的文件,在菜单中选择「快速操作」,然后选择「Send S3」即可上传该文件。
### Typora 集成
在 Typora 的「设置——图像——删除服务设定——命令」(上传服务选择「自定义命令」)中,添加以下命令:
```bash
send-s3 upload --typora
```
这样,Send S3 的输出结果可以被 Typora 识别,从而自动插入图片。
您需要修改 `send-s3` 的路径来使其正常工作。
## 查看历史
Send S3 会记录上传历史,可以通过 `send-s3 log` 命令来查看。输出记录按照时间戳降序排列。
`send-s3 log` 默认输出 100 条记录,可以通过 `-l` 参数来限制输出的记录数量。
```bash
send-s3 log -l 10
```
您可以设置查询的起止时间:
```bash
send-s3 log --from 2012-07-12 --to 2024-07-12
send-s3 log --from 2012-07-12T11:00:00 --to 2024-07-12T19:00:00
```
您可以通过 `send-s3 log --json` 来输出 JSON 格式的记录,以供其他程序处理。
```bash
cos-uploader-history -n 10 -r
```
## 许可
Send S3 使用 MIT 协议
Raw data
{
"_id": null,
"home_page": "https://github.com/baobao1270/send-s3",
"name": "send-s3",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "uploader, s3, s3-compatible, cli",
"author": null,
"author_email": "Joseph Chris <joseph@josephcz.xyz>",
"download_url": "https://files.pythonhosted.org/packages/91/7c/0c8c445238ed1d33107c5cd5294bef3808ffe10d6a7797c701d8d5ac4280/send_s3-3.1.0.tar.gz",
"platform": null,
"description": "# Send S3\n\n\u8de8\u5e73\u53f0\u7684\u5bf9\u8c61\u5b58\u50a8\u4e0a\u4f20\u5de5\u5177\n\n - \u652f\u6301 Windows\u3001Linux\u3001MacOS\n - \u53ef\u4ee5\u7528\u4e8e\u56fe\u7247\u4e0a\u4f20\uff08\u56fe\u5e8a\uff09\u3001\u6587\u4ef6\u5206\u4eab\u7b49\n - \u5e26\u6709\u65e5\u5fd7\u8bb0\u5f55\u529f\u80fd\uff0c\u53ef\u4ee5\u67e5\u770b\u4e0a\u4f20\u5386\u53f2\n - \u652f\u6301\u901a\u8fc7\u7cfb\u7edf\u81ea\u5e26\u7684\u5de5\u5177\u5feb\u901f\u4e0a\u4f20\u6587\u4ef6\uff08Windows\uff1a\u300c\u53d1\u9001\u5230\u300d\uff1bMacOS\uff1a\u300c\u5feb\u6377\u6307\u4ee4\u300d\uff09\n\n\n## \u5b89\u88c5\n\u6211\u4eec\u63a8\u8350\u4f7f\u7528 [pipx](https://pypa.github.io/pipx/) \u5b89\u88c5 Send S3\uff0c\u8bf7\u53c2\u89c1\u5176\u5b98\u7f51\u6765\u5b89\u88c5 pipx\u3002\n\n```bash\n# \u5b89\u88c5\u65b9\u6cd5 1\uff1a\u4f7f\u7528 pipx \u5b89\u88c5 (\u63a8\u8350)\npipx install send-s3\n\n# \u5b89\u88c5\u65b9\u6cd5 2\uff1a\u4f7f\u7528 pip \u5b89\u88c5\npip3 install send-s3\n```\n\n## \u4f7f\u7528\n\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8bf7\u8fd0\u884c\u521d\u59cb\u5316\u547d\u4ee4\uff1a\n\n```bash\nsend-s3 init\n```\n\n\u521d\u59cb\u5316\u547d\u4ee4\u4f1a\u521b\u5efa\u5e94\u7528\u76ee\u5f55\uff1a\n - Windows\uff1a`%APPDATA%\\send-s3`\n - MacOS / Linux\uff1a`$XDG_CONFIG_HOME/.config/send-s3` \u6216 `~/.config/send-s3`\n\n\u8bf7\u786e\u4fdd `config.toml` \u6587\u4ef6\u5b58\u5728\u4e8e\u5e94\u7528\u76ee\u5f55\u4e2d\uff0c\u4e14 `secret-id`\u3001`secret-key`\u3001`bucket`\u3001`region` \u7b49\u53c2\u6570\u5df2\u7ecf\u914d\u7f6e\u6b63\u786e\uff0c\u5426\u5219\u65e0\u6cd5\u4e0a\u4f20\u6587\u4ef6\u3002\n\n\u5982\u679c\u8f93\u5165 `send-s3 init` \u540e\u63d0\u793a\u627e\u4e0d\u5230\u547d\u4ee4\uff0c\u53ef\u80fd\u662f PATH \u73af\u5883\u53d8\u91cf\u6ca1\u6709\u751f\u6548\u6216\u6ca1\u6709\u914d\u7f6e\uff0c\u8bf7\u4f9d\u6b21\u68c0\u67e5\uff1a\n - \u91cd\u65b0\u542f\u52a8\u5f53\u524d shell\uff0c\u5982 `exec zsh` \u6216 `exec bash`\n - \u91cd\u65b0\u542f\u52a8\u5f53\u524d\u7ec8\u7aef\uff0c\u5728 GUI \u4e0b\u5e94\u9000\u51fa\u7ec8\u7aef\u5e94\u7528\uff08iTerm2 \u4e0b\u6309 <kbd>Command \u2318</kbd> + <kbd>Q</kbd>\u3001Windows Terminal \u4e0b\u5173\u95ed\u7a97\u53e3\uff09\n - \u67e5\u770b PATH \u53d8\u91cf\n - \u4f7f\u7528 pipx\uff0c\u9700\u8981\u6839\u636e pipx \u7684\u63d0\u793a\u5c06 `~/.local/bin` \u6dfb\u52a0\u5230 PATH\n - Windows \u7248\u7684 Python \u9ed8\u8ba4\u4e0d\u4f1a\u5c06 `Scripts` \u6dfb\u52a0\u5230 PATH\uff0c\u9700\u8981\u624b\u52a8\u6dfb\u52a0\u3002\u6253\u5f00 [\u8bbe\u7f6e\u2014\u2014\u7cfb\u7edf\u2014\u2014\u5173\u4e8e](ms-settings:about) \u70b9\u51fb\u53f3\u4fa7\u300c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u300d\uff0c\u6dfb\u52a0 `C:\\Users\\<\u7528\u6237\u540d>\\AppData\\Roaming\\Python\\<Python\u7248\u672c>\\Scripts` \u5230 PATH\n - \u5982\u679c\u4f7f\u7528\u4e86\u624b\u52a8\u521b\u5efa\u865a\u62df\u73af\u5883\u5b89\u88c5\uff08\u5b89\u88c5\u65b9\u6cd5 3\uff09\uff0c\u8bf7\u5c06 `~/.cos-uploader/bin` \u6dfb\u52a0\u5230 PATH\n\n\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528 `cos-uploader` \u547d\u4ee4\u6765\u4e0a\u4f20\u6587\u4ef6\u3002\n\n```bash\n# \u4e0a\u4f20\u6587\u4ef6\u8bd5\u8bd5\uff0c\u6d4b\u8bd5\u914d\u7f6e\u662f\u5426\u6b63\u786e\necho \"Hello World\" > hello.txt\nsend-s3 upload hello.txt\n```\n\n### Windows \u5e73\u53f0\u529f\u80fd\n\u5728\u8fd0\u884c `send-s3 init` \u540e\uff0c\u4f1a\u5728\u300c\u8d44\u6e90\u7ba1\u7406\u5668\u300d\u4e2d\u6dfb\u52a0\u300c\u53d1\u9001\u5230\u300d\u83dc\u5355\u9879\uff0c\u53ef\u4ee5\u5728\u300c\u8d44\u6e90\u7ba1\u7406\u5668\u300d\u4e2d\u53f3\u952e\u6587\u4ef6\uff0c\u7136\u540e\u9009\u62e9\u300c\u53d1\u9001\u5230\u300d\uff0c\u518d\u9009\u62e9\u300cSend S3\u300d\u6765\u4e0a\u4f20\u6587\u4ef6\u3002\n\n### MacOS \u5e73\u53f0\u529f\u80fd\n\n\u8bf7\u5bfc\u5165 [Send S3 \u5feb\u6377\u6307\u4ee4](https://www.icloud.com/shortcuts/b84eab4b8df141d89a25f048047ea4ff)\n\n\u5bfc\u5165\u5b8c\u6210\u540e\uff0c\u8bf7\u6253\u5f00\u300c\u5feb\u6377\u6307\u4ee4\u300dApp\uff0c\u9009\u62e9\u5de6\u4e0a\u89d2\u83dc\u5355\u4e2d\u7684\u300c\u5feb\u6377\u6307\u4ee4\u2014\u2014\u8bbe\u7f6e\u2014\u2014\u9ad8\u7ea7\u300d\uff0c\u52fe\u9009\u300c\u5141\u8bb8\u8fd0\u884c\u811a\u672c\u300d\u3002\n\n\u914d\u7f6e\u5b8c\u6210 `config.toml` \u540e\uff0c\u5728 Finder \u4e2d\u53f3\u952e\u60f3\u8981\u4e0a\u4f20\u7684\u6587\u4ef6\uff0c\u5728\u83dc\u5355\u4e2d\u9009\u62e9\u300c\u5feb\u901f\u64cd\u4f5c\u300d\uff0c\u7136\u540e\u9009\u62e9\u300cSend S3\u300d\u5373\u53ef\u4e0a\u4f20\u8be5\u6587\u4ef6\u3002\n\n### Typora \u96c6\u6210\n\u5728 Typora \u7684\u300c\u8bbe\u7f6e\u2014\u2014\u56fe\u50cf\u2014\u2014\u5220\u9664\u670d\u52a1\u8bbe\u5b9a\u2014\u2014\u547d\u4ee4\u300d\uff08\u4e0a\u4f20\u670d\u52a1\u9009\u62e9\u300c\u81ea\u5b9a\u4e49\u547d\u4ee4\u300d\uff09\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u547d\u4ee4\uff1a\n \n```bash\nsend-s3 upload --typora\n```\n\n\u8fd9\u6837\uff0cSend S3 \u7684\u8f93\u51fa\u7ed3\u679c\u53ef\u4ee5\u88ab Typora \u8bc6\u522b\uff0c\u4ece\u800c\u81ea\u52a8\u63d2\u5165\u56fe\u7247\u3002\n\n\u60a8\u9700\u8981\u4fee\u6539 `send-s3` \u7684\u8def\u5f84\u6765\u4f7f\u5176\u6b63\u5e38\u5de5\u4f5c\u3002\n\n## \u67e5\u770b\u5386\u53f2\nSend S3 \u4f1a\u8bb0\u5f55\u4e0a\u4f20\u5386\u53f2\uff0c\u53ef\u4ee5\u901a\u8fc7 `send-s3 log` \u547d\u4ee4\u6765\u67e5\u770b\u3002\u8f93\u51fa\u8bb0\u5f55\u6309\u7167\u65f6\u95f4\u6233\u964d\u5e8f\u6392\u5217\u3002\n\n`send-s3 log` \u9ed8\u8ba4\u8f93\u51fa 100 \u6761\u8bb0\u5f55\uff0c\u53ef\u4ee5\u901a\u8fc7 `-l` \u53c2\u6570\u6765\u9650\u5236\u8f93\u51fa\u7684\u8bb0\u5f55\u6570\u91cf\u3002\n\n```bash\nsend-s3 log -l 10\n```\n\n\u60a8\u53ef\u4ee5\u8bbe\u7f6e\u67e5\u8be2\u7684\u8d77\u6b62\u65f6\u95f4\uff1a\n\n```bash\nsend-s3 log --from 2012-07-12 --to 2024-07-12\nsend-s3 log --from 2012-07-12T11:00:00 --to 2024-07-12T19:00:00\n```\n\n\u60a8\u53ef\u4ee5\u901a\u8fc7 `send-s3 log --json` \u6765\u8f93\u51fa JSON \u683c\u5f0f\u7684\u8bb0\u5f55\uff0c\u4ee5\u4f9b\u5176\u4ed6\u7a0b\u5e8f\u5904\u7406\u3002\n\n```bash\ncos-uploader-history -n 10 -r\n```\n\n## \u8bb8\u53ef\nSend S3 \u4f7f\u7528 MIT \u534f\u8bae\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI tool for uploading files to S3-compatible storage services.",
"version": "3.1.0",
"project_urls": {
"Changelog": "https://github.com/baobao1270/send-s3/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/baobao1270/send-s3/blob/main/README.md",
"Homepage": "https://github.com/baobao1270/send-s3",
"Repository": "https://github.com/baobao1270/send-s3.git"
},
"split_keywords": [
"uploader",
" s3",
" s3-compatible",
" cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9ece872503f227188dfcb7ca7ba6e6f8292f62362bc6b6d6d117e06e8b0ed385",
"md5": "86d3e50349cdefb9189d9425821ce72f",
"sha256": "20ecb8f09a003229384d21a1010078d24fdc218827fa481ca7fea3f20e0611d2"
},
"downloads": -1,
"filename": "send_s3-3.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "86d3e50349cdefb9189d9425821ce72f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 16554,
"upload_time": "2024-06-15T16:57:37",
"upload_time_iso_8601": "2024-06-15T16:57:37.869019Z",
"url": "https://files.pythonhosted.org/packages/9e/ce/872503f227188dfcb7ca7ba6e6f8292f62362bc6b6d6d117e06e8b0ed385/send_s3-3.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "917c0c8c445238ed1d33107c5cd5294bef3808ffe10d6a7797c701d8d5ac4280",
"md5": "5cd957ef76ae9a6b2335c1b844d50e49",
"sha256": "efef03655c2d446f98f371e760fe696f7f6e3440053ab4d6ec5682018020599b"
},
"downloads": -1,
"filename": "send_s3-3.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5cd957ef76ae9a6b2335c1b844d50e49",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 15108,
"upload_time": "2024-06-15T16:57:39",
"upload_time_iso_8601": "2024-06-15T16:57:39.442791Z",
"url": "https://files.pythonhosted.org/packages/91/7c/0c8c445238ed1d33107c5cd5294bef3808ffe10d6a7797c701d8d5ac4280/send_s3-3.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-15 16:57:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "baobao1270",
"github_project": "send-s3",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "send-s3"
}