> ## 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.

# Receive Files with Hayate on Any Platform

> Run hayate receive to accept incoming transfers on your LAN. Use Pairing Mode with a code phrase or listen on a specific port for direct connections.

`hayate receive` starts a listener that accepts one incoming transfer and then exits. You can run it in **Pairing Mode** — where it locates the sender automatically using a shared code phrase — or in **Direct Mode**, where it binds to a known port and waits for the sender to dial in. Both modes fully encrypt the transfer; Pairing Mode additionally uses the code phrase as a salt in the HKDF key derivation, so only peers sharing the exact phrase can decrypt the payload.

## Pairing Mode Receive

Pass `--code` with the phrase your sender is using. Hayate listens for the sender's mDNS or UDP broadcast announcement and connects automatically once it finds a matching peer.

```bash theme={null}
hayate receive --code "cherry-blossom-spring"
# Output: ● Waiting for sender with code: cherry-blossom-spring
```

<Note>
  Pairing Mode has a **60-second discovery timeout**. If Hayate doesn't hear a matching sender broadcast within that window, it exits with a timeout error. Make sure the sender has already run `hayate send --code "..."` before this timer elapses.
</Note>

## Direct Mode Receive

In Direct Mode, Hayate binds to a UDP port and waits. Tell the sender your machine's IP address and the port number you chose. The default port is `50001`.

```bash theme={null}
hayate receive --port 50001
# Output: ● Listening on 0.0.0.0:50001 via QUIC [io_uring]
```

Hayate prints all interface addresses so you can easily tell the sender which IP to use.

## Specifying an Output Directory

Use `--output` to control where received files are saved. If the directory doesn't exist, Hayate creates it. The default is the current working directory.

```bash theme={null}
hayate receive --port 50001 --output ~/Downloads/
```

When the transfer completes, Hayate prints the full saved path and the computed checksum.

## Auto-Accept

By default, Hayate shows a confirmation prompt when a transfer offer arrives, letting you inspect the filename, size, and sender address before accepting. Use `--auto-accept` to skip the prompt — useful in scripts, automated pipelines, or headless environments.

```bash theme={null}
hayate receive --code "my-phrase" --auto-accept
```

## Binding to a Specific Interface

If your machine has multiple network adapters — for example, a wired and a wireless interface — use `--bind` to pin the listener to a specific IP address. This prevents Hayate from accepting connections on unintended interfaces.

```bash theme={null}
hayate receive --bind 192.168.1.100 --port 50001
```

## Environment Variables

You can set default values for `--bind` and `--port` using environment variables, avoiding the need to type them on every invocation.

| Variable      | Equivalent flag | Default   |
| ------------- | --------------- | --------- |
| `HAYATE_BIND` | `--bind`        | `0.0.0.0` |
| `HAYATE_PORT` | `--port`        | `50001`   |

```bash theme={null}
export HAYATE_PORT=9000
hayate receive  # listens on port 9000
```

Command-line flags always take precedence over environment variables.

## Headless and No-Progress Mode

For scripted or headless use, combine `--no-progress` and `--auto-accept` to run with no interactive output or prompts.

```bash theme={null}
hayate receive --code "my-phrase" --no-progress --auto-accept
```

Hayate still prints the final transfer summary (saved path and checksum) to stdout even with `--no-progress`, so you can capture it in logs or scripts.

## Command Aliases

`hayate receive` has two shorter aliases — `hayate recv` and `hayate rx` — which are identical in behaviour and accept the same flags.

```bash theme={null}
hayate recv --code "my-phrase"
hayate rx --port 50001 --output ~/Downloads/
```

## Transfer Completion

When a transfer finishes successfully, Hayate prints a summary that includes:

* The filename and total bytes received
* Transfer speed and elapsed time
* The output path where the file was saved
* The computed checksum (Blake3 or SHA-256, matching what the sender used)

You can compare the checksum with the sender's output to independently verify the transfer.
