> ## Documentation Index
> Fetch the complete documentation index at: https://hayate.shiina.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# hayate receive — Accept Incoming QUIC File Transfers

> hayate receive starts a QUIC listener for incoming transfers. Key flags: --code for Pairing Mode, --output for the save directory, --auto-accept.

`hayate receive` starts a QUIC listener on your machine and waits for an incoming file or directory transfer from a Hayate sender. It supports two modes: **Pairing Mode**, where you share a code phrase with the sender and let mDNS and UDP broadcast handle discovery automatically, and **Direct Mode**, where you bind to a specific port and the sender connects to your IP address directly. All data is decrypted on arrival and verified against the integrity checksum negotiated during the handshake.

## Usage

```
hayate receive [OPTIONS]
```

**Aliases:** `hayate recv`, `hayate rx`

## Options

<ParamField query="-b, --bind" type="string" default="0.0.0.0">
  IP address to bind the QUIC listener to. Defaults to `0.0.0.0`, which listens
  on all available network interfaces. Set this to a specific interface IP (e.g.
  `192.168.1.100`) if you want to restrict incoming connections to a single
  network. Also configurable via the `HAYATE_BIND` environment variable.
</ParamField>

<ParamField query="-p, --port" type="number" default="50001">
  UDP port to listen on. Hayate uses UDP because QUIC runs over UDP. Defaults to
  `50001`. You can use any unused port above `1024`. Also configurable via the
  `HAYATE_PORT` environment variable.
</ParamField>

<ParamField query="-o, --output" type="string" default=".">
  Directory where received files and directories are saved. Defaults to your
  current working directory. The path is created if it does not already exist.
  When `--auto-accept` is off, Hayate shows this value as the default in the
  interactive prompt, and you can override it per transfer.
</ParamField>

<ParamField query="--auto-accept" type="boolean" default="false">
  Skip the interactive confirmation prompt and accept all incoming transfers
  without asking. Files are saved directly to `--output`. Useful for unattended
  or scripted scenarios — pair it with `--no-progress` for fully headless
  operation.
</ParamField>

<ParamField query="--code" type="string">
  Pairing code phrase for mDNS and UDP discovery. Provide the same phrase that
  the sender passed to `hayate send --code`. Hayate listens for the sender's
  broadcast, connects automatically once it finds a matching phrase, and then
  proceeds with the transfer. If no matching sender is found within 60 seconds,
  Hayate exits with a timeout error.
</ParamField>

<ParamField query="--no-progress" type="boolean" default="false">
  Disable the live progress bar and transfer speed display. Useful when running
  Hayate in a headless environment, inside a container, or when capturing output
  to a log file where ANSI escape codes would appear as raw characters.
</ParamField>

<ParamField query="--color" type="string" default="auto">
  Control colored terminal output. Accepted values:

  * `auto` *(default)* — color when stdout is a TTY; honors `NO_COLOR`, `CLICOLOR`, and `CLICOLOR_FORCE`
  * `always` — always emit ANSI color codes, even when output is redirected
  * `never` — plain text output with no color
</ParamField>

## Environment variables

| Variable      | Effect                                                      |
| ------------- | ----------------------------------------------------------- |
| `HAYATE_BIND` | Sets the default value for `--bind` without passing a flag  |
| `HAYATE_PORT` | Sets the default value for `--port` without passing a flag  |
| `NO_COLOR`    | Disables all styled terminal output regardless of `--color` |

## Examples

```bash theme={null}
# Wait for sender with matching code
hayate receive --code "cherry-blossom-spring"

# Listen on a custom port, save to ~/Downloads
hayate receive --port 50002 --output ~/Downloads

# Auto-accept without prompt (for scripts)
hayate receive --code "my-phrase" --auto-accept

# Bind to a specific network interface
hayate receive --bind 192.168.1.100 --port 50001

# Headless mode
hayate receive --code "my-phrase" --no-progress --auto-accept
```

## What happens on transfer

When a sender connects, Hayate walks through these stages automatically:

1. **Discovery or connection** — in Pairing Mode, Hayate finds the sender via mDNS and UDP broadcast using the shared code phrase. In Direct Mode, it waits for the sender to dial in.
2. **Handshake** — Hayate negotiates an ephemeral X25519 key and selects either AES-256-GCM (hardware-accelerated) or ChaCha20-Poly1305 as the per-frame cipher.
3. **Transfer offer** — Hayate displays the incoming filename, size, transfer type (file or directory), sender address, cipher, and integrity algorithm. If `--auto-accept` is off, you are prompted to accept or reject and to confirm (or change) the save directory.
4. **Progress bar** — a live bar shows bytes received, current throughput, and ETA. Suppressed with `--no-progress`.
5. **Summary** — after the transfer completes, Hayate prints the saved path, total size, wall-clock duration, average speed, and the verified checksum.

<Note>
  In Pairing Mode, Hayate waits up to **60 seconds** for the sender's broadcast.
  If no matching sender is found within that window, the command exits with a
  timeout error. Make sure both sides are on the same LAN and use exactly the
  same code phrase — including capitalization and spacing.
</Note>
