instatunnel
Version:
Expose your localhost to the internet instantly - the ngrok alternative that's 40% cheaper with superior UX
30 lines (24 loc) • 647 B
JavaScript
const { spawn } = require('child_process');
const path = require('path');
const os = require('os');
const platform = os.platform();
const binDir = path.join(__dirname, 'bin');
let binaryName = 'it';
let binaryPath = path.join(binDir, binaryName);
// Use the direct binary path
const child = spawn(binaryPath, process.argv.slice(2), {
stdio: 'inherit',
shell: false
});
child.on('error', (error) => {
console.error('Failed to start it:', error.message);
process.exit(1);
});
child.on('exit', (code, signal) => {
if (signal) {
process.kill(process.pid, signal);
} else {
process.exit(code || 0);
}
});