I don’t know the js implementation that much but by default the file is pinned on your node (so your node will provide it forever).
If someone else fetch it they will either not reprovide it if they disabled this feature, else this will stay until they run a garbage collection ipfs repo gc or automaticaly with the ipfs daemon --enable-gc.
What happens if I turn off my computer and then someone else tries to retrieve it?
Theoricaly if an other other people have the file they will send it, but that rare as much of the time you don’t publish one file but many and nodes will only download a few subset of that (eg. someone fetching your website might reprovide the index.html but not your subpages if he havn’t visited them).
If you want your file to be reliabely accessible on the network you should think that if you don’t provides your files, no one will (what is good about ipfs is that if lots of peoples download your file they will reshare it, so your bandwith usage scales negatively (more users = more bandwith)).
If its lifetime is temporary, how do I make it permanent?
You can either do it manualy using ipfs pin or through a cluster managing your pins using ipfs cluster even if you don’t want to use the cluster feature (syncing the pins of multiples server) I would still advise you to setup a cluster along with your server as this is simple and provides async pinning and more features than the raw go-ipfs (such as names, expirations date, …).
You could also pay a company to host them for you (somes are listed here https://docs.ipfs.io/concepts/persistence/#pinning-services), I’ve personaly tryed the free plan of pinata for a short while and I have nothing to say, it works likes you expect a pinning service to work, they pin your file and provides them, latency and bandwith is very average for what you can expect from any VPS you can setup (you might get better performance if you subscribe to the entreprise option (you will have your own VPS)).
PS: I’ve realised I havn’t actualy explained pinning, so you can pin files, directory, and there child, …
Pinned objects are never removed from the repo and if they are not in the repo they are downloaded from the network, it’s the canonical way to ensure your files are always available on the ipfs network.
I don’t know the js implementation that much but by default the file is pinned on your node (so your node will provide it forever).
If someone else fetch it they will either not reprovide it if they disabled this feature, else this will stay until they run a garbage collection ipfs repo gc or automaticaly with the ipfs daemon --enable-gc .
You can either do it manualy using ipfs pin or through a cluster managing your pins using ipfs cluster even if you don’t want to use the cluster feature (
So is it pinned by default, or do you have to pin it manually?
And if I understand correctly, pinning will basically make my uploaded file persist, even if my computer is turned off – correct?
If someone else fetch it they will either not reprovide it if they disabled this feature, else this will stay until they run a garbage collection ipfs repo gc or automaticaly with the ipfs daemon --enable-gc .
I don’t understand this. Are you saying that, even if someone has fetched my file, it is still possible that the contents can eventually disappear from the network, if they have disabled pinning?
$ ipfs add --help
...
--pin bool - Pin this object when adding. Default: true.
...
No it makes it persists but only on your computer, if you want the file to be available when your computer is off (or ipfs is not running) you must pin it elsewhere (idealy a 24/24h server), you can setup your own using ipfs cluster or pay a company such as pinata.
Yes, in 2 way :
It’s not because someone fetched your file he is gonna reprovide, he might choose to not do it (that rare).
Even he is gonna reprovide it his storage space isn’t infinite so the garbage collection will eventually remove it after a while when he is running out of space.
PS: A pin just tell your local node : Download this file now and cache it in the repo ! And if you are somehow running out of space don't remove that file, it's important to me and I want to keep it in my repo..
Is it possible to meaningfully use ipfs libs, without running the background ifps daemon? Asking because the background daemon kills my wifi
ipfs add <myfile> seems to work without the daemon - it stands to reason that it should be possible to build a full fledged app without the background demon…(pun!)
That would likely be because lots of people have used 1.js and its CID is widely available in various caches throughout the ipfs. Try doing it with some other (uniquely your’s) content and I suspect your results will be different.
I changed the content to something random and I got a valid hash that I could look up on ipfs.
It’s worked 3/3 times.
Relatedly, just to clarify: the fact that I’m able to see the data via the gateway means that I’m actually reading stuff from the decetralized network, as opposed to looking up my local cache - is that correct?
You could either accept that you can’t share files
Depends, wich gateway ? (if it’s your localhost daemon, the same that you use to add the data it’s totaly your cache).
If it’s a public one such as https://jorropo.ovh/ipfs/bafybeifx7yeb55armcsxwwitkymga5xf53dxiarykms3ygqic223w5sk3m#x-ipfs-companion-no-redirect yes you are indeed publishing stuff in the distributed network. But be aware that if you have ipfs companion it might redirect you to your own gateway without you noticing, so try with #x-ipfs-companion-no-redirect.
I meant the ipfs.io/ipfs gateway - a public one. I tried ipfs.io/ipfs/<hash>?x-ipfs-companion-no-redirect and I was able to successfully view my data…all without spinning ipfs daemon.
So…this means that I can share and upload stuff, without explicitly spinning ipfs daemon?
Yes and no, currently your very example a node still have your file cached but this is not reliable because nodes doesn’t keep random content indefinitely, if nobody downloads your file and you retry in 1 week your file will likely not be available.
But those pins are still local and will only be reliably accessible by others if there is some sort of node running on your machine. Unless you pay a pinning service to pin them external to your machine.