zmq-fileserver/README.md

32 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2020-06-20 18:29:09 +02:00
# `zmq-fileserver`
This is a simple fileserver written in PHP (7.4+) using [ZeroMQ](https://zeromq.org/).
2020-06-20 19:06:44 +02:00
It requires `ext-zmq` and PHP7.4+.
2020-06-20 18:29:09 +02:00
There are three executable files:
2020-06-20 19:04:10 +02:00
- `$ bin/server` runs the fileserver
- `$ bin/command <arg1> <arg2> ...` sends a command to the server
- `$ bin/query <arg1> <arg2> ...` sends a query to the server and returns the response
2020-06-20 18:29:09 +02:00
## Commands
- `SAVE <namespace> <name> <contents>` saves a file
- `DELETE <namespace> <name>` deletes a file if it exists
- `DELETE_ALL <namespace>` deletes an entire namespace
To save a file to the fileserver you can do:
2020-06-20 19:04:10 +02:00
`$ bin/command SAVE my-project-namespace 1.html "<!DOCTYPE html><html>...</html>"`
`$ bin/command SAVE my-project-namespace 2.xml "$(cat some/xml/file)"`
2020-06-20 18:29:09 +02:00
## Queries
- `CONTAINS <namespace> <name>` returns `Y` if the file exists in the namespace, else `N`
- `LOAD <namespace> <name>` returns the file contents if it exists, else `-1`
To load a file from the fileserver you can do:
2020-06-20 19:04:10 +02:00
`$ bin/query LOAD my-project-namespace 1.html`
## Configuration
2020-06-20 18:29:09 +02:00
2020-06-20 19:04:10 +02:00
See `config/config.ini`. It contains an example configuration.