File Transfer over WebRTC Data Channels
Learn how to send files peer-to-peer through WebRTC data channels, including chunking, backpressure, ordering, and progress tracking.
Beyond Chat: Sending Files
WebRTC data channels are not limited to text chat. They can carry arbitrary binary data, which makes peer-to-peer file transfer possible without uploading to a server.
This keeps large files off your infrastructure and lowers latency.
Binary Types on the Channel
A data channel can send strings or binary. For files you set binaryType so received data arrives as an ArrayBuffer.
const channel = pc.createDataChannel('file');
channel.binaryType = 'arraybuffer';All lessons in this course
- Synchronizing WebRTC Metadata
- Real-time Chat over Data Channels
- Sharing Application State Live
- File Transfer over WebRTC Data Channels