IPFS: Difference between revisions

From NixOS Wiki
imported>JackyWangMislantiaJnirvana
No edit summary
imported>Mbledkowski
No edit summary
Line 9: Line 9:
   enable = true;
   enable = true;
   settings.Addresses.API = ["/ip4/127.0.0.1/tcp/5001"];
   settings.Addresses.API = ["/ip4/127.0.0.1/tcp/5001"];
}
};
</syntaxhighlight>
</syntaxhighlight>
Currently <code>settings.Addresses.API</code> need to be non-empty, otherwise Kubo will not start. See [https://github.com/ipfs/kubo/issues/10056#issuecomment-1674104498 this issue] for details.
Currently <code>settings.Addresses.API</code> need to be non-empty, otherwise Kubo will not start. See [https://github.com/ipfs/kubo/issues/10056#issuecomment-1674104498 this issue] for details.

Revision as of 15:36, 26 August 2023

IPFS (InterPlanetary File System) is a protocol, hypermedia and file sharing peer-to-peer network for storing and sharing data in a distributed file system. IPFS aims to make the web more efficient, resilient, and open by using content-addressing to uniquely identify each file in a global namespace. IPFS also enables persistent availability of data with or without internet backbone connectivity, and complements HTTP.

Installation

Install and enable kubo, which is the recommended IPFS implementation

services.kubo = {
  enable = true;
  settings.Addresses.API = ["/ip4/127.0.0.1/tcp/5001"];
};

Currently settings.Addresses.API need to be non-empty, otherwise Kubo will not start. See this issue for details.

Usage

Publish a file and read it afterwards

# echo "hello world" > hello
# ipfs add hello
This should output a hash string that looks something like:
QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
# ipfs cat <that hash>

Download a file given a hash

# ipfs get <hash>

Publish and print directory content. For the ls command, use the hash of the root directory.

# ipfs add -r folder
# ipfs ls <hash>
# ipfs ls <hash>/subdirectory