alanshaw / ipfs-only-hash

#️⃣ Just enough code to calculate the IPFS hash for some data
MIT License
135 stars 28 forks source link

Add directory support #23

Open JulienPlanchetCoineo opened 2 years ago

JulienPlanchetCoineo commented 2 years ago

See https://github.com/alanshaw/ipfs-only-hash/issues/18 Added pattern

alanshaw commented 2 years ago

It's hard to review this as there's so many other changes which are not related.

JulienPlanchetCoineo commented 2 years ago

It's hard to review this as there's so many other changes which are not related.

Hello, like what ? Maybe I can help ? Also, I've found that using this on lot of files in a directory returns a Qm hash that doesn't match the one of the directory if I do "ipfs add -r -n ." on a root folder All IPFS hash v0 will be greatly calculated on files inside a folder, but the last CID (which is the parent directory one) will not be good. Any idea ?

JulienPlanchetCoineo commented 2 years ago

It's hard to review this as there's so many other changes which are not related.

Hello, like what ? Maybe I can help ? Also, I've found that using this on lot of files in a directory returns a Qm hash that doesn't match the one of the directory if I do "ipfs add -r -n ." on a root folder All IPFS hash v0 will be greatly calculated on files inside a folder, but the last CID (which is the parent directory one) will not be good. Any idea ?

Nevermind, fixed it by adding options.shardSplitThreshold = maxFilesNumbers. By default, shardSplitThreshold is set to 1,000 files. If I hash a directory with >= 1,000 files, the hash is not the same as the one on IPFS cmd