English | [ç®ä½ä¸æ](translations/README-cn.md)
## ðHttpCat Overview
HttpCat is an HTTP file transfer service, designed to provide a simple, efficient, and stable solution for file uploading and downloading.
Project goals: To create a reliable, efficient, and user-friendly HTTP file transfer Swiss Army Knife that greatly enhances your control and experience with file transfers.
Whether it's for temporary sharing or bulk file transfers, HttpCat will be your excellent assistant.
Please note that this translation is a direct translation and may require further refinement by a professional translator for the best results.
## ð¥Key Features
* Simple and easy to use
* No external dependencies, easy to port
## ðInstallation
### Quick Installation
You can directly download the latest httpcat installation package.
After extracting it, simply run the `install.sh` script to install.
```bash
httpcat_version="v0.1.5"
mkdir target_directory
tar -zxvf httpcat_$httpcat_version.tar.gz -C target_directory
```
```bash
cd target_directory/release
./install.sh
```
```bash
systemctl status httpcat
systemctl stop httpcat
systemctl start httpcat
tail -f /root/log/httpcat.log
```
#### For versions prior to v0.1.2
1. Download the latest httpcat installation package.
`https://github.com/shepf/httpcat-release/tags`
2. Planning and creating directories for httpcat usage
Assuming we plan to start the project as follows:
```bash
/usr/local/bin/httpcat --port=80 --static=/home/web/website/httpcat_web/ --upload=/home/web/website/upload/ --download=/home/web/website/upload/ -C /etc/httpdcat/svr.yml
```
* --port Specify the listening port for httpcat.
* --upload Specify the directory for uploading files.
* --download Specify the directory for downloading files.
* -C Specify the configuration file to use. (Note: Modify the location of the SQLite file storage as needed: sqlite_db_path: "./data/sqlite.db")
Prepare the directory for file uploads (we will use the same directory for uploads and downloads):
```bash
mkdir -p /home/web/website/upload/
```
Prepare the web static resource directory.
```bash
mkdir -p /home/web/website/httpcat_web/
```
Prepare the directory for storing configuration files.
```bash
mkdir -p /etc/httpdcat/
```
3. Installation
```bash
mkdir httpcat
cd httpcat
```
Upload the installation package: httpcat_v0.1.1.tar.gzãhttpcat_web_v0.1.1.zip
install httpcat
```bash
tar -zxvf httpcat_v0.1.1.tar.gz
cp httpcat /usr/local/bin/
cp conf/svr.yml /etc/httpdcat/
```
install httpcat_web
```bash
cp httpcat_web_v0.1.1.zip /home/web/website/
cd /home/web/website/
unzip httpcat_v0.1.1.tar.gz
mv dist httpcat_web
```
check
```bash
httpcat -v
httpcat -h
```
The command-line parameters for running on Windows are the same as on Linux, except that you use httpcat.exe instead of httpcat.
```bash
httpcat.exe --upload /home/web/website/download/ --download /home/web/website/download/ -C F:\open_code\httpcat\server\conf\svr.yml
```
### Run in the background using tmux
You can use tmux to run in the background:
```bash
Create a new tmux session using a socket file named tmux_httpcat
$ tmux -S tmux_httpcat
# Once inside tmux, you can execute running commands, such as:
httpcat --static=/home/web/website/upload/ -C server/conf/svr.yml
Move process to background by detaching
Ctrl+b d OR â+b d (Mac)
To re-attach
$ tmux -S tmux_httpcat attach
Alternatively, you can use the following single command to both create (if not exists already) and attach to a session:
$ tmux new-session -A -D -s tmux_httpcat
To delete farming session
$ tmux kill-session -t tmux_httpcat
```
### Linux can use systemd to run in the background
The installation package comes with an httpcat.service file that allows you to run httpcat in the background using systemd.
You can modify the httpcat.service file according to your needs.
For example, you can modify the ExecStart parameter in the httpcat.service file to specify your own startup parameters.
To add a listening port parameter, you can add --port=80:
```bash
ExecStart=/usr/local/bin/httpcat --port=80 --static=/home/web/website/httpcat_web/ --upload=/home/web/website/upload/ --download=/home/web/website/upload/ -C /etc/httpdcat/svr.yml
```
```bash
cp httpcat.service /usr/lib/systemd/system/httpcat.service
sudo systemctl daemon-reload
sudo systemctl start httpcat
```
> Note: You may need to modify the startup parameters according to your needs.
> Ensure that the following three directories are consistent (so that the upload directory is also the download directory,
> and it is also the web frontend directory where files can be downloaded without authentication).
```bash
vi httpcat.service
```
```
ExecStart=/usr/local/bin/httpcat --static=/home/web/website/upload/ --upload=/home/web/website/upload/ --download=/home/web/website/upload/ -C /etc/httpdcat/svr.yml
```
## httpcat web frontend
The new version includes a frontend page. Prior to v0.1.1, the frontend was released separately, and users could choose to download it according to their needs.
Starting from v0.1.2, the frontend is directly integrated into the installation package, eliminating the need to separately download frontend files.
Since httpcat comes with built-in static resource file handling, users have the freedom to decide whether to use the frontend page.
This frontend is a single-page application. In the production environment, static resources are accessed through the /static route, while API endpoints are accessed through the /api route.
If users set up their own Nginx server, they should configure the /static route to point to the static resource directory and the /api route to the httpcat service.
To use the frontend, download the release package and extract it to the web directory. httpcat will automatically load the static resource files from the web directory.
The web directory is specified in the configuration file using the static parameter. If not specified, the default location is the website/static directory under the current directory.
Alternatively, you can specify the directory using command-line parameters, such as:
```bash
--static=/home/web/website/httpcat_web/
```
### Frontend Deployment
1. Download the standalone frontend release file, such as httpcat_web_xxx.zip.
2. Extract it to the web directory
```bash
cd /home/web/website/
unzip httpcat_web_v0.1.1.zip
mv dist httpcat_web
```
3. Starting the httpcat Service
To start the service, you need to specify the web interface directory using the --static parameter. For example:
```bash
./httpcat --static=/home/web/website/httpcat_web/ -C conf/svr.yml
```
4. Accessing the httpcat Frontend Service
```bash
http://127.0.0.1:8888
```
## ⤠Tips and Tricks
### File Operation Related APIs
#### Uploading Files Using Curl Tool
```bash
curl -v -F "f1=@/root/hello.mojo" -H "UploadToken: httpcat:dZE8NVvimYNbV-YpJ9EFMKg3YaM=:eyJkZWFkbGluZSI6MH0=" http://localhost:8888/api/v1/file/upload
```
The curl command is used to send a multipart/form-data format POST request to the specified URL. Here is an explanation of each part:
- `curl`: curl is a tool used for transferring data to/from a server, supporting multiple protocols.
- `-v`: Detailed operational information is displayed during command execution, which is known as verbose mode.
- `-F "f1=@/root/hello.mojo"`: Specifies the form data to be sent. The -F option indicates that a form is being sent, and f1=@/root/hello.mojo indicates that the file field to be uploaded is named f1, with the file path /root/hello.mojo. The value of this field is the relative or absolute path to the local file.
- `http://localhost:8888/api/v1/file/upload`: è¦åé请æ±å°ç URLï¼è¿æ¡å½ä»¤ä¼å°æ件ä¸ä¼ å°è¿ä¸ª URLã
- `-H "UploadToken: httpcat:dZE8NVvimYNbV-YpJ9EFMKg3YaM=:eyJkZWFkbGluZSI6MH0="`: "Upload Token" is a uniqu
HttpCat 是一个基于 HTTP 的文件传输服务,旨在提供简单、高效、稳定的文件上传和下载功能v0.1.5版本
需积分: 1 33 浏览量
2024-04-08
08:36:54
上传
评论
收藏 43.33MB GZ 举报
西京刀客
- 粉丝: 16w+
- 资源: 50
最新资源
- 基于matlab实现电力系统仿真计算软件包,包括潮流计算,最优潮流计算等.rar
- 基于matlab实现电力系统各种故障波形仿真,单相接地故障,两相间短路,两相接地短路,三相短路等.rar
- 基于matlab实现电动汽车动力性,爬坡性,续驶里程等性能仿真.rar
- Python动态烟花代码.pdf
- 基于matlab实现串口发送接收数据 可配置端口,波特率等 发送可选择ASCII方式或HEX方式
- matlab基于BP神经网络手写字母识别(单一).zip代码9
- 基于matlab实现编写的串口调试工具,数据接收部分采用中断方式,保证了实时的数据显示
- 基于matlab实现39节点电力系统合闸角调控过程中的机组和负荷的灵敏度计算.rar
- HBase数据库性能调优
- 原生微信小程序源码 - -首字母排序选择
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈