my-airdrop 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cli.js +11 -0
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -194,6 +194,17 @@ async function main() {
194
194
  console.log(` ${chalk.gray(time)} ${arrow} ${chalk.gray(ip.padEnd(15))} ${label}${sizeStr}`);
195
195
  });
196
196
 
197
+ server.on('error', e => {
198
+ if (e.code === 'EADDRINUSE') {
199
+ console.log('\n ' + chalk.yellow(`⚠ Port ${port} in use — trying ${port + 1}...`));
200
+ port += 1;
201
+ server.listen(port, '0.0.0.0');
202
+ } else {
203
+ console.error(chalk.red(' Error: ' + e.message));
204
+ process.exit(1);
205
+ }
206
+ });
207
+
197
208
  server.listen(port, '0.0.0.0', async () => {
198
209
  console.clear();
199
210
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-airdrop",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Share files over local network — like AirDrop but from your terminal",
5
5
  "keywords": [
6
6
  "file-sharing",