Closed dryajov closed 7 years ago
One more thing, I have tentatively set maxLength
to 1024 as a default, but we might want to increase that to something larger if its too low of a number.
@dryajov I've updated master to have passing tests again. Please rebase onto it so I can merge
@dignifiedquire thanks, I'll update the length!
@dignifiedquire think this is ready now?
@dignifiedquire any reason to not just do require('safe-buffer')
and let it polyfill automatically here - https://github.com/dignifiedquire/pull-length-prefixed/blob/master/src/encode.js#L3?
tests are failing on node 4 even tho I'm pulling safe-buffer
, looking into it.
Seems like in node 4, if the fill value is something other than a string and no encoding is explicitly specified, then it will not encode it with anything and simply fill in the raw bytes - https://github.com/nodejs/node/blob/v4.x/lib/buffer.js#L109, which is different from how later versions behave, where buffer is also defaulted to 'utf8'.
@dignifiedquire can we get this published to npm please 😄? This is needed for https://github.com/libp2p/js-libp2p-circuit/pull/9
sorry for the delay, published a new version @dryajov
@dignifiedquire adding this since we need to control the max msg size in circuit.
FYI, some tests are failing, but they were failing before my changes, I haven't yet taken a look at it, will do soon, but you might know whats going on.