mytextfile.txtand put the text "version 1 of my text" in it. Here is an easy way to do this on the command line:
ipfs add mytextfile.txtwithout the
-wflag, ipfs only returned one hash. This time it returned two hashes. The first hash
QmZtmD2...is the same as before — it's the hash of the content inside the file. The second hash
QmPvaEQF...is the hash of the directory and filename information that ipfs "wrapped" around our content.
-wflag tells ipfs to include the directory and filename information along with the content — it "wraps the file in a directory". For more info about this, run
ipfs add --helpand read the description there.
ipfs ls. You will use the
-vflag to include header information. To learn more about this command, run
ipfs ls --help
ipfs ls QmPvaEQFVvuiaYzkSVUp23iHTQeEUpDaJnP8U7C3PqE57wtranslates to "list the files referenced by the directory whose hash is QmPvaEQFVvuiaYzkSVUp23iHTQeEUpDaJnP8U7C3PqE57w".
ipfs lsinstead of
ipfs catto read this info because it's a directory. If you try to read the directory using
ipfs catyou will get an error:
mytextfile.txtwithin the directory whose hash is QmPvaEQFVvuiaYzkSVUp23iHTQeEUpDaJnP8U7C3PqE57w"
ipfs add -wand confirm that ipfs is re-using the hash of that content when it builds the directory and filename information.