‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Tuesday, December 18, 2018 2:07 PM, Laura Lazzati <laura.lazzati...@gmail.com> wrote:
> On Tue, Dec 18, 2018 at 10:00 AM Björn Höfling > bjoern.hoefl...@bjoernhoefling.de wrote: > > > Hi Laura, > > I'm sending this also to guix-devel [and sorry for the previous, empty, > > private mail, I was too fast on the sending button]. > > Note: I'm also new to IPFS, so I hope everything is correct here, if > > someone knows better, please reply. > > On Tue, 18 Dec 2018 00:04:56 -0300 > > Laura Lazzati laura.lazzati...@gmail.com wrote: > > > > > > A good guide is: > > > > https://medium.com/textileio/the-definitive-guide-to-publishing-content-on-ipfs-ipns-dfe751f1e8d0. > > > > > Sorry, I read the documentation, but I am mixed up. > > > I have my peer identity, and my /ipfs/hash... > > > And I find confusing several things: > > > If I run ipfs add myfile, using my command line, I cannot find myfile > > > in my node. even the add command returns a hash for that file I guess. > > > And if I run ipfs ls or cat that hash, the file is shown. > > > > I don't get what you mean with "I cannot find my file". Where are you > > looking for it? > > > > > I found useful for instance the webui, but when running ipfs add, my > > > files don't appear there if I open it and the other way around either: > > > the files are there if I upload them in the webui, and they have a > > > hash. I can copy the hash from the webui, but it doesn't work if I run > > > ipfs ls on that hash. And the files added with ipfs add myfile do not > > > appear in the webui. The webui however has an option to share your > > > file, I don't know if that is useful. > > > > You have in IPFS file-objects and directory-objects. The command 'ipfs > > ls' is for listing the contents of directory-objects (i.e. list the > > files in that directory). If you use it on file-objects (that exit in > > the store), the command just returns with no output. > > This works for me: > > I have the daemon down, i.e. no 'ipfs daemon' started. > > Then I can still add things to my local IPFS-store: > > > > mkdir baz > > echo "foo" > baz/foo.txt > > echo "bar" > baz/bar.txt > > echo "Hello World, now it is $(date -u -Ins)" > baz/hello.txt > > cat baz/hello.txt > > > > Hello World, now it is 2018-12-18T12:08:57,304514914+00:00 > > > > > > ipfs add -r baz/ > > added QmTz3oc4gdpRMKP2sdGUPZTAGRngqjsi99BPoztyP53JMM baz/bar.txt > > added QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 baz/foo.txt > > added QmXXZWRsLhFAHNWW6tH4TJVB2UiUPsUX8TZhYavqTne6RH baz/hello.txt > > added QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg baz > > 67 B / 67 B > > [=========================================================] 100.00% > > > > > > Now I can open the web-browser: > > > > localhost:9090/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 > > > > --> (Note:I changed my port from default 8080 to 9090, on 8080 is > > already something listening) Unable to connect, I don't have the daemon > > up yet. > > > > https://ipfs.io/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 > > > > --> Shows "foo", as this Hash is already uploaded in the global network > > by someone else. > > > > https://ipfs.io/ipfs/QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg > > > > --> That is with the hash of the directory. Times out, this is not found > > on the global network. > > > > > > Starting daemon: > > > > ipfs daemon > > > > Browser: > > > > localhost:5001/webui > > > > Redirects: > > > > > > http://localhost:5001/ipfs/QmSDgpiHco5yXdyVTfhKxr3aiJ82ynz8V14QcGKicM3rVh/#/ > > > > Entering hash of "foo" in the "Explore" tab: > > > > QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 > > > > Finds it, I can view it. > > > > Entering hash of "baz" directory: > > > > > > http://localhost:9090/ipfs/QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg > > > > Yes, it lists the directory. > > > > Globally available: > > > > https://ipfs.io/ipfs/QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg > > > > I can see the directory structure. And I can see the files foo.txt, > > bar.txt and hello.txt listed: > > > > https://ipfs.io/ipfs/QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg/bar.txt > > > > > > But, the "hello.txt" takes its time to download, until now I still > > don't see it: > > > > > > https://ipfs.io/ipfs/QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg/hello.txt > > > > Probably that's because it first needs to search the network and find > > my little local host for that file. Hm. Strange. > > > > Ah, after 5 minutes, it's there! Maybe that's also your problem? > > > > Going to my server, daemon is down by default: > > > > myserver$ ipfs ls QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 > > Error: merkledag: not found > > > > myserver$ echo "foo" > foo.txt > > myserver$ ipfs add foo.txt > > added QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 foo.txt > > 4 B / 4 B > > [===========================================================] 100.00% > > myserver$ ipfs ls QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 > > myserver$ > > > > (i.e., no error, no output) > > > > > > > > myserver$ ipfs daemon & > > > > Looking for the directory: > > > > myserver$ ipfs ls QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg > > [Waiting 3 minutes nothing happens, then:] > > QmTz3oc4gdpRMKP2sdGUPZTAGRngqjsi99BPoztyP53JMM 12 bar.txt > > QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 12 foo.txt > > QmXXZWRsLhFAHNWW6tH4TJVB2UiUPsUX8TZhYavqTne6RH 67 hello.txt > > > > myserver$ ipfs cat > > QmZ9iMU1iKRpAs7dR7XTLGaYtkcYFn6EiMXRhqpk5jaeNg/hello.txt Hello World, > > now it is 2018-12-18T12:08:57,304514914+00:00 > > > > (instantly!) > > > > Hope this helps a bit, > > > > Björn > > > > Thank you! I will try it. I felt really silly for spending too much > time on that. I just want to share my videos so that you can see how > they are, even they are videos for trying out the video/translation > tools. BTW, I edited the libreplanet site, changing some stuff about > the commands that I faced, and adding comments about why I did so. > I am not running the daemon in background, since I don't mind having a > terminal open. I will write back to let you know if it your steps work > for me :) > > Thank you! > > Regards, > Laura Hi! I just joined this list today after meeting Guix people in Paris and my topic comes up :) It is not quite obvious that once you add a files to ipfs the standard way to list them is `ipfs pin ls` (`add` automatically pins), and that you only get hashes as the names of the folder/file is lost (unless you wrap it in another folder). One way around this is to use the `ipfs files` commands, which interact with something we call mfs (memory file system). I think the web UI uses this. This is basically allowing you to interact with IPFS as if it was a regular folder with contents. For example, you can add your file with `ipfs files write -e /myfile.txt myfile.txt` (or `cat myfile.txt | ipfs files write -e /myfile.txt`). Then you will see it with `ipfs files ls /`. You can create folders (`ipfs files mkdir /abc`) and move things around like in a normal filesystem. Finally, if you want to get the hash of the file, or the folder, in order to share it, you can run `ipfs files stat <path>` to get it (note that it will change if you modify anything in that folder or file). The `ipfs files --help` (also for any subcommands) gives more details about all this. Remember to run `ipfs files flush` to store persist your MFS filesystem on disk. Cheers, Hector