https://github.com/giucal/abserve
Serve a file from memory.
https://github.com/giucal/abserve
server
Last synced: 6 months ago
JSON representation
Serve a file from memory.
- Host: GitHub
- URL: https://github.com/giucal/abserve
- Owner: giucal
- License: isc
- Created: 2022-06-05T12:42:14.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-16T11:28:26.000Z (over 1 year ago)
- Last Synced: 2025-01-16T12:54:43.406Z (over 1 year ago)
- Topics: server
- Language: Go
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# [abserve(1)]
[abserve(1)]: man.pod
Minimal HTTP server that serves a *virtual* resource directly from
memory.
% echo '
Hello, world!
' | abserve /index.html &
[1] 56382
% curl http://localhost:8080/index.html
Hello, world!
## Overview
The resource is read either once and for all from standard input or, with the
`--poll` option, repeatedly from a FIFO:
% mkfifo resource.fifo
% abserve --poll resource.fifo &
[1] 56385
% echo A > resource.fifo
% curl http://localhost:8080
A
Writing to the FIFO causes abserve to update the resource:
% echo B > resource.fifo # update
% curl http://localhost:8080
B
% curl http://localhost:8080 # the resource is cached
B
It's also possible to serve *concrete* resources from a given
directory. The virtual resource takes precedence over anything else.
% ls
cat.jpg dog.jpg index.html
% cat index.html # index.html on disk
<img src="dog.jpg">
% echo '<img src="cat.jpg">' | abserve --directory . /index.html &
[1] 56388
% curl http://localhost:8080/index.html # virtual index.html
<img src="cat.jpg">
% curl http://localhost:8080/cat.jpg | catimg
Enough with cats. For details, see the [man page][abserve(1)].
## Installation
go install github.com/giucal/abserve@latest