How erfanvoj/rgb-file-transfer works
This browser application transfers files between air-gapped devices using animated color matrices and a camera. The main workflow is file selection, fountain-frame encoding, canvas display, camera capture, worker-based optical decoding, and file reconstruction. The graph includes the documented anchor/homography, calibration, and rolling-shutter clock stages. Source excerpts show core calls; some main-thread frame routing and completion details are supported by the README rather than the partial main.ts excerpt.
Main entry points: main.ts UI and camera coordinator · canvasRenderer.ts Canvas matrix renderer · worker.ts CV and matrix decoding worker · reassembler.ts Peeling decoder and reconstruction
Components 15
Browser coordination
- UI and camera coordinator
src/main.ts
Optical transmission
- Canvas matrix renderer
src/sender/canvasRenderer.ts
Optical reception
- CV and matrix decoding worker
src/receiver/worker.ts - Anchor detection and homography
src/receiver/anchorDetector.ts - Color calibration and cell sampling
src/protocol/chunker.ts - Peeling decoder and reconstruction
src/receiver/reassembler.ts
Wire protocol
- Transfer geometry and settings
src/config.ts - File chunking and frame encoding
src/protocol/chunker.ts - Fountain code primitives
src/protocol/fountain.ts
Other components
- User
- Device camera
- Sender display
- Selected file
- Optical link
- Recovered file
Connections 22
- User → UI and camera coordinator: selects file
README.md - UI and camera coordinator → Selected file: reads bytes
README.md - UI and camera coordinator → File chunking and frame encoding: creates encoder
src/main.ts - File chunking and frame encoding → Fountain code primitives: samples droplets
src/protocol/chunker.ts - UI and camera coordinator → Canvas matrix renderer: sets encoder
src/main.ts - Canvas matrix renderer → File chunking and frame encoding: gets frames
src/sender/canvasRenderer.ts - Canvas matrix renderer → Sender display: renders matrix
README.md - Canvas matrix renderer → Optical link: modulates frames
README.md - Optical link → Device camera: carries light
README.md - Device camera → UI and camera coordinator: provides video
src/main.ts - UI and camera coordinator → CV and matrix decoding worker: transfers frames
README.md - CV and matrix decoding worker → Anchor detection and homography: detects and rectifies
src/receiver/worker.ts - CV and matrix decoding worker → Color calibration and cell sampling: samples colors
src/receiver/worker.ts - CV and matrix decoding worker → UI and camera coordinator: posts decoded frames
README.md - UI and camera coordinator → Peeling decoder and reconstruction: passes packets
README.md - Peeling decoder and reconstruction → File chunking and frame encoding: validates frames
src/receiver/reassembler.ts - Peeling decoder and reconstruction → Fountain code primitives: recovers chunk indices
src/receiver/reassembler.ts - Peeling decoder and reconstruction → UI and camera coordinator: reports completion
src/main.ts - UI and camera coordinator → Recovered file: offers download
README.md - Canvas matrix renderer → Transfer geometry and settings: uses layout settings
src/sender/canvasRenderer.ts - CV and matrix decoding worker → Transfer geometry and settings: uses decode settings
src/receiver/worker.ts - Anchor detection and homography → Transfer geometry and settings: uses geometry
src/receiver/anchorDetector.ts