https://github.com/diegohce/hddproxy
A small proxy for web apps to access local files
https://github.com/diegohce/hddproxy
go golang local-file proxy webapp websocket websocket-server
Last synced: over 1 year ago
JSON representation
A small proxy for web apps to access local files
- Host: GitHub
- URL: https://github.com/diegohce/hddproxy
- Owner: diegohce
- License: gpl-3.0
- Created: 2019-04-03T04:36:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-17T20:47:52.000Z (over 6 years ago)
- Last Synced: 2023-03-11T14:37:53.781Z (over 3 years ago)
- Topics: go, golang, local-file, proxy, webapp, websocket, websocket-server
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# HDD Proxy
HDD Proxy is a dirver for web applications to access small text files on the local hard drive.
It runs as a service, preferable listening on `localhost`.
# How does it work
HDD Proxy offers an endpoint to write files to disk, and has available a websocket to send text files to web browser.
# Environment variables
Example env variables and their default values.
```bash
HDDPROXY_TCP_BIND="127.0.0.1:8080"
HDDPROXY_LONGPOLL="5"
HDDROXY_SHORTPOLL="1"
HDDPROXY_DIRS_SEP=":"
HDDPROXY_DIRS=""
```
`HDDPROXY_DIRS` variable is a list of directories separated (by default) with a colon (`:`) as in:
```bash
HDDPROXY_DIRS="/home/diego/tmp/stuff:/home/diego/tmp/stuff2"
```
This is the only mandatory variable.
Directories separator (`:`) can be changed setting `HDDPROXY_DIRS_SEP` variable.
# Write
To write files make an HTTP POST to `http://127.0.0.1:8080/hddproxy/write`
```json
{
"body": "Hello, World!",
"dir": "/home/diego/tmp/stuff",
"name": "hi.txt"
}
```
A response with status 200 OK means writing was successful.
# Read
For an example on how to read files, see `websockets.html` file.
# Build
Clone this repo and run `go build .`