https://github.com/notashelf/httpserve
Serve data straight from STDIN
https://github.com/notashelf/httpserve
Last synced: about 1 year ago
JSON representation
Serve data straight from STDIN
- Host: GitHub
- URL: https://github.com/notashelf/httpserve
- Owner: NotAShelf
- License: gpl-3.0
- Created: 2023-12-18T21:20:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-18T21:50:10.000Z (over 2 years ago)
- Last Synced: 2025-02-17T13:13:23.611Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🌐 httpserve
> A simple HTTP server written in Go that reads data from standard input (stdin) and serves it over HTTP.
> It allows users to transmit data through HTTP requests by piping data into the server via stdin.
## Usage
```console
httpserve -p -a
-f -c
```
**Options**
- `-p `: Set the port for the server (default: 8080)
- `-a
`: Set the address for the server (default: 0.0.0.0)
- `-f `: Set the filename header for downloaded content
- `-c `: Set the content-type header (default: application/octet-stream)
- `-user `: The user that will be used in authentication prompts
- `-password `: The password required to access served data
### Examples
1. Accessing served data without filename or content type
```bash
curl http://localhost:8080
```
Retrieves the served data from the default address, which is **`http://localhost:8080`**.
2. Downloading served data with specified filename and content type
```bash
curl -o output.txt -H "Content-Type: text/plain" http://localhost:8080
```
- `-o output.txt`: Saves the served data to a file named output.txt.
- `-H "Content-Type: text/plain"`: Specifies the content type of the requested data.
## Why?
Honestly, why not. Httpserve is designed to receive data from standard input and serve it over HTTP, offering a
pretty simple and flexible method for sharing and transmitting data across network endpoints.