1.1.0 (2026-04-26)
⚠ BREAKING CHANGES
String/Buffer conversion now matches Node.js Buffer semantics (#976)
stringToBuffer (and the conversion paths that use it) no longer validates hex input or masks high-bit ASCII characters. Behavior now mirrors Node.js's Buffer.from(str, encoding):
| Input | v1.0.19 | v1.1.0 |
|---|---|---|
stringToBuffer('abc', 'hex')
| throws | [0xAB] (trailing nibble dropped)
|
stringToBuffer('zzzz', 'hex')
| throws | [] (invalid chars truncate)
|
stringToBuffer('über', 'ascii')
| [0x7C, 0x62, 0x65, 0x72] (masked to 7-bit)
| [0xFC, 0x62, 0x65, 0x72] (full byte preserved)
|
Migration:
- If you relied on hex decoding throwing for odd-length or invalid input, validate the string yourself before calling (e.g.
/^[0-9a-fA-F]+$/.test(s) && s.length % 2 === 0). - If you relied on ASCII encoding stripping the high bit, switch to an explicit mask or use a different encoding (
'utf8'for text,'latin1'for the previous full-byte-pass-through behavior).