# What is the lifetime of uploaded files?

**URL:** <https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408>\
**Category:** Uncategorized\
**Created:** [November 10, 2020, 10:26pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408 "2020-11-10T22:26:37Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 10, 2020, 10:26pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/1 "2020-11-10T22:26:38Z")

</div>

Hello, total noob question

I just uploaded a file with `jsipfs ./mfile.txt.`

I can view it via the ipfs gateway.

I have a bunch of conceptual questions:

- How long is this stored for? Is it temporary?

- What happens if I turn off my computer and then someone else tries to retrieve it?

- If its lifetime is temporary, how do I make it permanent?

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [November 10, 2020, 10:48pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/2 "2020-11-10T22:48:47Z")

</div>

- How long is this stored for? Is it temporary?

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](https://cluster.ipfs.io/) 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](https://docs.ipfs.io/concepts/persistence/#pinning-services)), I’ve personaly tryed the free plan of [pinata](https://pinata.cloud/) 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.

---

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 10, 2020, 11:02pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/3 "2020-11-10T23:02:52Z")

</div>

Sorry, I don’t understand 🙂

> 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](https://cluster.ipfs.io/) 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?

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [November 11, 2020, 12:24am UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/4 "2020-11-11T00:24:20Z")

</div>

> [@nz21](#):
>
> So is it pinned by default, or do you have to pin it manually?

It is pinned by default :

```console
$ ipfs add --help
...
--pin bool - Pin this object when adding. Default: true.
...

```

> [@nz21](#):
>
> And if I understand correctly, pinning will basically make my uploaded file persist, even if my computer is turned off – correct?

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](https://cluster.ipfs.io) or pay a company such as [pinata](https://pinata.cloud/).

> [@nz21](#):
>
> if someone has fetched my file, it is still possible that the contents can eventually disappear from the network

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.`.

---

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 11, 2020, 3:58pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/5 "2020-11-11T15:58:01Z")

</div>

@Jorropo

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!)

---

<div class="post-metadata">

**Author:** ![ldeffenb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ldeffenb/32/3996_2.png) [@ldeffenb](https://discuss.ipfs.tech/u/ldeffenb)\
**Post date:** [November 11, 2020, 5:20pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/6 "2020-11-11T17:20:31Z")

</div>

I believe without the daemon, you would only be able to access stuff locally. No one else would be able to get to anything.

---

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 11, 2020, 5:36pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/7 "2020-11-11T17:36:51Z")

</div>

Thanks for clarifying.

I ran `node 1.js` from here, without starting my daemon: [https://github.com/ipfs/js-ipfs/tree/master/examples/ipfs-101](https://github.com/ipfs/js-ipfs/tree/master/examples/ipfs-101)

I’m able to successfully see the file on `ipfs.io/ipfs/<hash>`

How is this possible? Is it just looking up my local cache? That would contradict the last statement where it says:

> You just added and **retrieved a file from the Distributed Web**!

---

<div class="post-metadata">

**Author:** ![ldeffenb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ldeffenb/32/3996_2.png) [@ldeffenb](https://discuss.ipfs.tech/u/ldeffenb)\
**Post date:** [November 11, 2020, 5:48pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/8 "2020-11-11T17:48:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 11, 2020, 5:57pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/9 "2020-11-11T17:57:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [November 11, 2020, 6:07pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/10 "2020-11-11T18:07:44Z")

</div>

You could either accept that you can’t share files

> [@nz21](#):
>
> 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?

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](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`.

---

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 11, 2020, 6:12pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/11 "2020-11-11T18:12:53Z")

</div>

thanks @Jorropo

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?

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [November 11, 2020, 6:16pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/12 "2020-11-11T18:16:41Z")

</div>

> [@nz21](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 11, 2020, 6:19pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/13 "2020-11-11T18:19:32Z")

</div>

Thanks for clarifying - much appreciated 🙂

> 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.

Hmm but if I pin it, then it should be available forever right?

The example that I’m running uses: `node.add`, I’m not sure if that pins by default.  
[https://github.com/ipfs/js-ipfs/blob/master/examples/ipfs-101/1.js](https://github.com/ipfs/js-ipfs/blob/master/examples/ipfs-101/1.js)

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [November 11, 2020, 6:29pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/14 "2020-11-11T18:29:35Z")

</div>

> [@What is the lifetime of uploaded files?](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/4):
>
> It is pinned by default : $ 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](https://cluster.ipfs.io) or pay a company such as [pinata](https://pinata.cloud/). Yes, in 2 way : It’s not because someone fetched your file he is gonna reprovide, he might choose to not do it (that …

Yes this pins by default, you can also see your pins with `ipfs pin ls --type=recursive`.

---

<div class="post-metadata">

**Author:** ![ldeffenb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ldeffenb/32/3996_2.png) [@ldeffenb](https://discuss.ipfs.tech/u/ldeffenb)\
**Post date:** [November 11, 2020, 7:28pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/15 "2020-11-11T19:28:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nz21](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nz21](https://discuss.ipfs.tech/u/nz21)\
**Post date:** [November 11, 2020, 7:38pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/16 "2020-11-11T19:38:37Z")

</div>

can you give some examples on how to run such a pinned service?

In order to build anything meaningful (eg: file sharing app), I believe we would need such services - I couldn’t find any references to it in the docs

---

<div class="post-metadata">

**Author:** ![ldeffenb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ldeffenb/32/3996_2.png) [@ldeffenb](https://discuss.ipfs.tech/u/ldeffenb)\
**Post date:** [November 11, 2020, 7:46pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/17 "2020-11-11T19:46:19Z")

</div>

Try: [https://bfy.tw/Pd6L](https://bfy.tw/Pd6L)

---

<div class="post-metadata">

**Author:** ![ldeffenb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ldeffenb/32/3996_2.png) [@ldeffenb](https://discuss.ipfs.tech/u/ldeffenb)\
**Post date:** [November 11, 2020, 7:48pm UTC](https://discuss.ipfs.tech/t/what-is-the-lifetime-of-uploaded-files/9408/18 "2020-11-11T19:48:49Z")

</div>

Or there’s a list on this particular page in the docs:

> **[Persistence](https://docs.ipfs.io/concepts/persistence/)**
>
> Learn about how IPFS treats persistence and permanence on the web, and how pinning can help keep data from being discarded.
