Add a basic Unix socket server using Bun

- Implemented a simple server using the net module.
- The server listens on a specified socket path.
- Added error handling for server errors.
- Included checks to verify the existence of the socket file.
This commit is contained in:
Alex Newman
2025-10-16 17:07:14 -04:00
parent 834cf4095e
commit 2d080b0264
7 changed files with 862 additions and 83 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bun
import net from 'net';
import { existsSync } from 'fs';
const socketPath = '/Users/alexnewman/.claude-mem/test-bun.sock';
const server = net.createServer(() => {});
server.listen(socketPath, () => {
console.log('Server listening');
console.log('existsSync says:', existsSync(socketPath));
console.log('Checking with ls...');
});
server.on('error', (err) => {
console.error('Error:', err);
process.exit(1);
});