rtc-direct
v0.1.0
Published
P2P file transfer over WebRTC — like croc, powered by signallite
Readme
rtc-direct
Peer-to-peer file transfer over WebRTC. Like croc, but using WebRTC data channels for direct P2P connections.
Data flows directly between peers — the signaling server is only used for the initial handshake.
Usage
Send a file
npx rtc-direct send photo.jpgSending photo.jpg (2.4 MB)
Code: 7a3f-blue-river
On the other machine, run:
npx rtc-direct receive 7a3f-blue-riverReceive a file
npx rtc-direct receive 7a3f-blue-riverConnecting with code: 7a3f-blue-river
Waiting for sender...
Connected to peer!
Receiving photo.jpg (2.4 MB)
[████████████████████████] 100% | done
Done! Saved to ./photo.jpgOptions
rtc-direct send <file> [--server <url>]
rtc-direct receive <code> [--server <url>] [--out <path>]| Option | Description | Default |
|--------|-------------|---------|
| --server <url> | Signaling server URL | https://signallite.nikunjgupta.dev |
| --out <path> | Output directory (receive only) | . |
How it works
- Sender generates a short transfer code and waits for a peer
- Receiver connects using the same code
- signallite handles the WebRTC signaling (SDP offer/answer + ICE candidates)
- A direct peer-to-peer data channel is established
- The file is streamed in 16KB chunks with flow control
- The signaling server disconnects once peers are connected — all data flows directly
Self-hosting the signaling server
You can run your own signaling server:
npx @nkg447/signalliteThen point both peers to it:
npx rtc-direct send file.txt --server http://your-server:3000
npx rtc-direct receive <code> --server http://your-server:3000License
MIT
