Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/virb3/serve-zip
Simple HTTP server that streams directories as a ZIP
https://github.com/virb3/serve-zip
browser file http index light modern nginx server simple stream zip
Last synced: 3 months ago
JSON representation
Simple HTTP server that streams directories as a ZIP
- Host: GitHub
- URL: https://github.com/virb3/serve-zip
- Owner: ViRb3
- Created: 2022-11-25T20:07:07.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-16T13:08:19.000Z (7 months ago)
- Last Synced: 2024-06-17T13:58:00.360Z (7 months ago)
- Topics: browser, file, http, index, light, modern, nginx, server, simple, stream, zip
- Language: XSLT
- Homepage:
- Size: 112 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# serve-zip
> Simple HTTP server that streams directories as a ZIP
## Introduction
This server is a dependency for setting up a dead simple, modern file browser using nginx. There are two parts:
1. [autoindex.xslt](./autoindex.xslt), which renders HTML pages to navigate, preview, and download individual files
2. This server, which allows you to download entire directories as a ZIP file![](screenshot.png)
## Usage
> **:warning: There is no form of authentication built into this project. It is left for you to set up!**
1. Run this server using the binary in releases or [Docker image](https://hub.docker.com/r/virb3/serve-zip). Run with `--help` to see all available options:
```bash
Usage: serve-zip
Simple HTTP server that streams directories as a ZIP.
Arguments:
Path from which to serve files.
Flags:
-h, --help Show context-sensitive help.
--symlinks Follow symlinks. WARNING: Allows escaping the root path!
--hidden Serve files and directories that start with dot.
--level=0 ZIP compression level (0/store - 9/highest).
--prefix="/" URL prefix to be removed before serving.
--host="" Host on which to listen, empty for all.
--port=8080 Port on which to listen.
--json Log in JSON instead of pretty printing.
```2. In your `/etc/nginx/nginx.conf`, add the following line at the top:
```nginx
load_module modules/ngx_http_xslt_filter_module.so;
```3. Drop [autoindex.xslt](./autoindex.xslt) in a path like: `/etc/nginx/static/autoindex.xslt`
4. Set up your file browser conf file, adjusting the server url, autoindex path, and root directory if necessary:
```nginx
location @zip {
proxy_pass http://serve-zip:8080;
}
error_page 418 = @zip;
location / {
if ($arg_zip) {
return 418;
}
autoindex on;
autoindex_format xml;
autoindex_exact_size off;
autoindex_localtime off;
xslt_stylesheet /etc/nginx/static/autoindex.xslt;
root /my-data/;
}
```## Credits
[autoindex.xslt](./autoindex.xslt) is a modified version of [Nginx-Autoindex](https://github.com/EvilVir/Nginx-Autoindex).
This server borrows some code from [gosses](https://github.com/ViRb3/gosses).