hookah icon indicating copy to clipboard operation
hookah copied to clipboard

Add delimiter option

Open wybiral opened this issue 4 years ago • 0 comments

It would be useful to be able to align writes based on a delimiter character, especially for reading text protocols like stdin, file, tcp, serial, etc.

For example hookah -d "\n" -i serial:///dev/ttyACM0 -o ws://localhost:8080 would read each line from the serial device and send them to the WebSocket connection (not including the newline delimiter).

This is an incredibly common piping task and would make things like newline-delimited JSON streams easier to work with.

The only downside is that messages larger than the buffer will still have to be split (to avoid memory issues) so stripping the delimiter would make it impossible to determine boundaries for those messages. But in that case you may just need a bigger buffer.

wybiral avatar Apr 26 '20 12:04 wybiral