Why another file sharing tool?
I got tired of sending files to myself via email, Telegram, or Google Drive just to copy a script or APK from my desktop to my phone. AirDrop only works on Apple devices. I needed a zero-configuration, cross-platform solution that worked over the local network.
How it Works
The system utilizes three core steps:
- Start a local HTTP server on the computer.
- Auto-detect the computer's local network IP address (e.g.,
192.168.1.15). - Generate a QR code in the terminal containing the server's URL.
You scan the QR code with your phone, and it opens a simple, responsive web application where you can upload or download files instantly at local Wi-Fi speeds.
Auto-Detecting the Local IP in Node.js
Here is how the tool gets the active local interface IP address dynamically:
const os = require('os');
function getLocalIP() {
const interfaces = os.networkInterfaces();
for (const name of Object.keys(interfaces)) {
for (const iface of interfaces[name]) {
// Skip internal (loopback) and non-IPv4 addresses
if (iface.family === 'IPv4' && !iface.internal) {
return iface.address;
}
}
}
return 'localhost';
}
const localIP = getLocalIP();
console.log(`Server running at: http://${localIP}:8080`);
Adding WebSockets for Real-Time Progress
To show progress bars on both the sender and receiver screen, I integrated a basic WebSocket server. When a phone starts uploading a 100MB file, the Node.js server streams the chunks to disk and updates the desktop display in real time. It is secure, operates 100% offline, and is incredibly fast.