Closed ralphtheninja closed 2 years ago
After some clarification on Discord, using b4a
is by design and it was a choice to base everything on the typed array interface in hyperdrive
but this doesn't play nicely with hypercore@9
. The solution was to use random-access-memory@3
until hypercore@10
will be in the dependencies for hyperdrive
.
Hi!
This issue might be misplaced, sorry if that's the case. But lets start here and see where we end up.
So my use case is using
hyperswarm-web
inpeermaps-web
and I run into the errorbuf.readUInt32BE is not a function
which in turns happens insidehypercore
which depends on theuint64be
module, which in turn tries to make thebuf.readUInt32BE()
call.So the problem is that there is a mismatch between
Buffer
andUint8Array
somewhere and I tracked it down to the.read()
method that callsb4a.alloc()
https://github.com/hypercore-skunkworks/b4a/blob/main/browser.js#L33-L37If I just rename
browser.js
insideb4a
to_browser.js
then everything just works since browserify replaces Buffer properly. Not sure if the fix should be insideb4a
or if we should just remove theb4a
dependency altogether and replace withBuffer
.