keichi / binary-parser

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

add saveoffset method #109

Closed Toxicable closed 5 years ago

Toxicable commented 5 years ago

Based off this MR for the most part: https://github.com/keichi/binary-parser/pull/89

This allows for saving the current internal offset to a variable returned to the user.

My use case for this is checking that the offset at the end of a dynamic read matches the length of the input buffer.

Taking suggestions on the name of this, im not sold on saveoffset

keichi commented 5 years ago

I think saveoffset is fine. How about currentOffset or bytesRead?

Toxicable commented 5 years ago

lets go with saveoffset then, I think it'll work

keichi commented 5 years ago

Ok, merging

keichi commented 5 years ago

@Toxicable I realized the documentation uses saveOffset. Do you wanna go with saveOffset or saveoffset?