Open ribasushi opened 4 years ago
Additional info requested by @hugomrdias to potentially incorporate a slimmed-down version of the rabin chunker into the wasm version
@hugomrdias aside from that: yes: the rabin chunker as written here is complete, and there isn't much more left to squeeze out note that my "intake" interface is slightly different due to being a radically changed framework, so it will take a little massaging to retrofit instead of readers, it expects a buffer and an indication whether "more is coming" or not chunkCB is where it passes each chunk as it finds them https://github.com/ipfs/DAGger/blob/19fc1fd0e8/dagger/chunker/ipfs/rabin/rabin.go#L28-L89
@hugomrdias note I have not looked at the wasm version, so I can't guarantee this will be better, but it likely can be ( I do away with the window buffer entirely )
Something that may cause a problem here is that the default polynomial
value of 17437180132763653
used by go-IPFS with the rabin chunker is a bigger number than you can represent in JS:
It needs to use long or bignumber.js BigInt
to represent it instead.
In go-ipfs
raw-leaves
defaults totrue
whencid-version=1
is specified. Additional the defaults forrabin
are identical torabin-262144
which translates torabin-87381-262144-393216
However js-ipfs does otherwise, observe:
Produced via: