Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/miraclx/zy

Minimal and blazingly-fast file server. For real, this time.
https://github.com/miraclx/zy

cli command-line http rust server static-file

Last synced: 9 days ago
JSON representation

Minimal and blazingly-fast file server. For real, this time.

Awesome Lists containing this project

README

        

# Zy

> Minimal and blazing-fast file server. For real, this time.

[![Crates.io](https://img.shields.io/crates/v/zy?label=latest)](https://crates.io/crates/zy)
[![CI](https://github.com/miraclx/zy/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/miraclx/zy/actions/workflows/ci.yml)
[![MIT or Apache 2.0 Licensed](https://img.shields.io/crates/l/zy.svg)](#license)

## Features

- [Single Page Application support](https://developer.mozilla.org/en-US/docs/Glossary/SPA)
- Partial responses ([Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) support)
- Cross-Origin Resource Sharing ([CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS))
- [Automatic HTTP compression](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding) (Zstd, Gzip, Brotli, Deflate)
- Dynamic [cache control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) (ETag, Last-Modified, Cache-Control)
- Auto-served `index.html` files
- Sane defaults
- No access to hidden files
- No access to content outside the base directory
- No access to symbolic links outside the base directory

## Installation

You can download any of the pre-compiled binaries from the [releases page](https://github.com/miraclx/zy/releases).

Or if you already have Rust installed, you can install it with `cargo`:

> - Please, note that the minimum supported version of Rust for `zy` is `1.59.0`.
> - Also, that the binary may be bigger than expected because it contains debug symbols. This is intentional. To remove debug symbols and therefore reduce the file size, you can instead run it with the `--profile slim` or simply just run `strip` on it.

```console
cargo install zy
```

Alternatively, you can also build the latest version of `zy` directly from GitHub.

```console
cargo install --git https://github.com/miraclx/zy.git
```

## Usage

```console
zy
```

_This will start serving your current directory on by default._

_...you can also specify a different port or base directory:_

```console
zy /path/to/serve
```

_...or perhaps different addresses:_

```console
zy -l 5000 -l 127.0.0.1:8080 -l 192.168.1.25
```

## Configuration

You can run `zy --help` to see all available options.

```console
$ zy --help
Zy 0.2.0
Minimal and blazing-fast file server.

USAGE:
zy [OPTIONS] [DIR]

ARGS:
Directory to serve [default: .]

OPTIONS:
-l, --listen Sets the address to listen on (repeatable) [default: 127.0.0.1:3000]
Valid: `3000`, `127.0.0.1`, `127.0.0.1:3000` [env: PORT]
-s, --spa Run as a Single Page Application
-i, --index Index file to serve from the base directory [default: index.html]
--404 404 file to serve from the base directory [default: 404.html]
-c, --cache

## Credits

Zy was originally inspired by [sfz](https://github.com/weihanglo/sfz), [serve](https://github.com/vercel/serve) and [http-server](https://github.com/http-party/http-server). It is written in [Rust](https://rust-lang.org) and uses [actix](https://github.com/actix/actix-web) as the web framework.

## Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as below, without any additional terms or conditions.

## License

Licensed under either of

- Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or )
- MIT license
([LICENSE-MIT](LICENSE-MIT) or )

at your option.