Send a file with IPFS

October 15, 2017

Sending a file with IPFS is fun (after all it is leveraging the peer-to-peer network and content-addressable blocks of data!) and easy.

Install IPFS

Here is the basic instructions to install:

tar -xvzf go-ipfs*
cd go-ipfs
sudo ./
ipfs init
ipfs config Addresses.Gateway /ip4/
ipfs config Addresses.API /ip4/

The last two lines are useful for listening on LAN connected devices. The port will let run the IPFS daemon on a different computer but still use the peer-to-peer portal from that computer.

Then start the daemon with

ipfs daemon

You could also start the daemon with an init script.1

Load the file into IPFS

Then add the file to IPFS. When you add the file to IPFS it copy the file to your IPFS repo (usually ~/.ipfs) and it will not touch the original file.

$ ipfs add somefile
added QmSr1saoM3n1Sx8dBs5bz7ozU somefile

Send it!

Then tell your friend to download file using the IPFS hash from the output:


This link does not require the user to have IPFS. It uses the public gateway,, which lookup peers from their main IPFS servers.

Cleanup (optional)

Once your friend has the file, then you can remove the file from being hosted on IPFS (if you want). Even though you’ll still have the file in the original location, it will no longer be served from your IPFS daemon.

ipfs pin rm QmSr1saoM3n1Sx8dBs5bz7ozU
ipfs repo gc

Note: after deletion your content may still be stored in the IPFS Gateway cache for some time (not sure how long).

Show comments
Written on 15 October 2017. Categories: coding, ipfs.

«Most sentences are unique 
Sending a file in 2017»