Repository navigation
Breaking changes
- ESM only. The CommonJS build has been removed and the package is now
"type": "module". Useimport { Parser } from "binary-parser". Node.js >= 22.12 can stillrequire()it viarequire(esm). (#308) - Node.js 22.12 or later is required (was 14). Output now targets ES2022. (#303, #346)
- Stricter validation. The following now throw instead of silently misbehaving:
__proto__as an associative array key (#322, #328)- An array element that consumes no bytes in
readUntil: "eof"orlengthInBytesarrays, which previously looped forever (#319) stringtypes inchoice()andwrapped()whenvarNameis omitted (#325)- Non-string or unsupported
encodingvalues; encodings are validated withTextDecoderat compile time (#345)
- Behavior changes:
New features
skipBits()to skip bits without storing them (#331)- Length
0is allowed forstring,buffer,wrappedandarray(#320)
Bug fixes
- Greedy strings no longer leave the offset one past the end of the buffer (#315)
- Strings with both
lengthandzeroTerminatedare parsed correctly (#318) bitN()andstring()no longer mutate the caller's options object (#317)sizeOf()and parser compilation no longer overflow the stack on long chains (#333, #340)- Assertions on deferred bit fields inside nested parsers work (#341)
- Buffer and Node.js built-ins are detected by feature instead of
window(#304) - Fixed typos in
choiceerror messages (#316) - Fixed the bundled examples (#309, #310, #311, #312, #313)
Other
- Tests migrated to Vitest and run on Node.js, Bun, Deno and browsers (#302, #304, #307)
- Switched to TypeScript 7, oxlint and oxfmt (#305, #337, #342, #344)
- npm packages are published with provenance (#314)
Thanks to @Lezvix, @hippi345, @Aschenbath and @imsurya26 for contributing!
Full Changelog: v2.3.1...v3.0.0