Gen_tcp style Data Buffering with QUIC

:gen_tcp buffers incoming data automatically with the option :packet.
Are there any standalone libraries that do something similar?

Can you elaborate a bit? What sort of inputs are you getting, what sort of outputs or buffering criterion are you trying to do? What about :gen_tcp is ill suited for what you want to do?

I want to transmit data between two machines using the protocol QUIC. the library msquic is doing the heavy lifting already, but does not offer an option like :packet from :gen_tcp.
Incoming binary data needs to be buffered, until enough data arrived to decode it using :erlang.binary_to_term. The simplest way to do that would be to prepend the size of the binary packet in front of the actual packet:
<<byte_size(data)::32, data::binary>>.
Surely someone else had the same or a similar problem and I want to avoid writing my own binary buffer code for it.

1 Like