Can I get the hash for my data without adding it to IPFS?

From @Blackphidora on Tue Feb 14 2017 06:16:49 GMT+0000 (UTC)

more for curiosities sake. But it would be nice to see the hash before making the final write.

Copied from original issue: https://github.com/ipfs/faq/issues/227

From @RichardLitt on Tue Feb 14 2017 16:10:21 GMT+0000 (UTC)

Do you mean something like ipfs ls <hash>, ipfs get <hash>, or ipfs refs <hash>? All of these work with existing hashes. Or you could check on the gateway.

If you’re curious about getting a hash of your data without adding the content to IPFS, and then checking; I’m not sure if that is possible at the moment. Someone else will know more.

From @Blackphidora on Tue Feb 14 2017 16:13:24 GMT+0000 (UTC)

Your second paragraph is what I’m looking for.

From @RichardLitt on Tue Feb 14 2017 16:17:18 GMT+0000 (UTC)

Renamed it to be a bit clearer. Let me know if that’s not OK!

From @RichardLitt on Tue Feb 14 2017 16:18:05 GMT+0000 (UTC)

It looks like ipfs add <data> -n would work for you. From ipfs add -h:

  -n,     --only-hash           bool   - Only chunk and hash - do not write to disk. Default: false.

From @Blackphidora on Tue Feb 14 2017 16:19:02 GMT+0000 (UTC)

badass, Thanks a ton. I havent actually deployed IPFS yet, so I couldnt see the --help :confused:

From @RichardLitt on Tue Feb 14 2017 16:21:25 GMT+0000 (UTC)

Just tested. This works as you would expect - I got the hash, but was unable to get it locally or through the gateway.

From @VictorBjelkholm on Wed Feb 15 2017 10:31:19 GMT+0000 (UTC)

You can use the -n flag to ipfs add to just chunk and hash the file and
not add it to IPFS.

-n,         --only-hash           bool   - Only chunk and hash - do not
write to disk.

On Tue, Feb 14, 2017 at 5:13 PM, Ryan Walter notifications@github.com
wrote:

Your second paragraph is what I’m looking for.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/ipfs/faq/issues/227#issuecomment-279753298, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAcD9OS97RvYNZZ2dzbGCDnz6JPXLUIcks5rcdKmgaJpZM4MAGew
.

Is there a library to compute the hash without having to run a IPFS node ?
So far it seems I can maybe use https://github.com/ipld/js-ipld and https://github.com/ipfs/js-ipfs-unixfs-importer
This seems overkill though.
Is there not a simple way to generate hash of a folder of files ?