binary-parser
binary-parser copied to clipboard
[HELP] Can someone help in understanding how to parse this type of buffer?
Hello Guys, can someone explain how to parse a buffer with this structure?

I managed to do it till here:
const patParse = new Parser()
.uint8("table_id")
.bit1("section_syntax_indicator")
.bit1("zero")
.bit2("reserved")
.bit12("section_length")
.uint16("transport_stream_id")
.bit2("reserved")
.bit5("version_number")
.bit1("current_next_indicator")
.uint8("section_number")
.uint8("last_section_number")
but I do not know how to manage the "for"/"if" with unknown length.
thanks for your help!
If you know the size of the buffer, you could calculate the number of elements (N) and pass it to the length or lengthInBytes option of the array parser.