keichi / binary-parser

A blazing-fast declarative parser builder for binary data
MIT License
857 stars 133 forks source link

Feature request #251

Open bergmorten opened 7 months ago

bergmorten commented 7 months ago

Thanks for a good tool.

I have a packet stream where parsing of a packet depends on a variable in the first packet. Since it is a stream I can not parse the whole dataset at once. So what I want is is store these variable and use them as input to the following packets/parsers.

E.g. something like this


let bytesPerSample = 4; // read in the first header packet

const result = myParser.parse(buffer, {bytesPerSample }) // Parser take an optional parseroptions