how to do ipfs pin add and get within 10 seconds?

595 Views Asked by At

In my project, I need to download data from ipfs by giving a CID.

What I do is:

  1. ipfs pin add {CID}
  2. ipfs get {CID}

But I found these two steps are quite time-consuming, it takes at least 1min above. I tried localhost and infura. What can I do to let it download faster?

1

There are 1 best solutions below

0
On

When you just want to download files, there is no need to pin them first. This might save a (tiny) bit of overhead.

However, the bulk time is probably spent in

  1. Looking up nodes in the distributed hash table that provide your data, and
  2. Actually transferring the data from these nodes.

For small data sizes, the first item is probably the limiting factor. In general, the duration depends on the number of nodes that host your connects to and how fast these nodes (can) transfer the data to your client.