2020-10-01 01:56:22 +02:00
|
|
|
---
|
|
|
|
tags: tutorial, ipfs
|
|
|
|
---
|
|
|
|
|
2020-09-25 03:04:00 +02:00
|
|
|
# Share file with ipfs
|
|
|
|
|
|
|
|
**Warning:** Only tested serving the file, not downloading it
|
|
|
|
|
|
|
|
1. [Install ipfs](https://ipfs.io/#install)
|
|
|
|
2. Initiate ipfs main folder `ipfs init`, not sure why but this is required for following commands
|
|
|
|
3. Serve a file `ipfs add {filepath}`. It should return something like this
|
2020-10-01 02:24:08 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
added QmdsEVLRXioANssEVLRXYioANsGtANsGtRXYioANsGtAWZ file.md
|
|
|
|
37.62 KiB / 37.62 KiB [===========================] 100.00%
|
|
|
|
```
|
|
|
|
|
2020-09-25 03:04:00 +02:00
|
|
|
4. Start server with `ipfs daemon`
|
2020-10-01 01:34:11 +02:00
|
|
|
5. **Missing step**, server seems to need an open port (not firewalled)
|
2020-10-01 01:35:48 +02:00
|
|
|
6. Download file from any device `ipfs get /ipfs/QmdsEVLRXioANssEVLRXYioANsGtANsGtRXYioANsGtAWZ` <-- that's the hash returned from **step 3**
|
2020-09-25 03:04:00 +02:00
|
|
|
|
2020-10-01 02:24:08 +02:00
|
|
|
```bash
|
|
|
|
$ ls
|
|
|
|
QmdsEVLRXioANssEVLRXYioANsGtANsGtRXYioANsGtAWZ
|
|
|
|
```
|
|
|
|
|
2021-02-19 22:25:22 +01:00
|
|
|
Notice the filename is just the hash, the original filename is lost.
|
2020-09-25 03:04:00 +02:00
|
|
|
|
2020-10-01 02:24:08 +02:00
|
|
|
**Note:** *IPNS seems to solve the filename problem, need to research on how to use it*
|
2020-09-25 03:04:00 +02:00
|
|
|
|
2021-02-19 22:25:22 +01:00
|
|
|
## Troubleshoot
|
|
|
|
<https://github.com/ipfs/go-ipfs/blob/master/docs/file-transfer.md>
|
|
|
|
|
2020-09-25 03:04:00 +02:00
|
|
|
## What led to learning this
|
|
|
|
|
2020-10-01 02:21:34 +02:00
|
|
|
[Random news of ipfs in HN](https://blog.ipfs.io/2020-09-24-go-ipfs-0-7-0/). It just reminded me I've never tried it out.\
|
2020-09-25 03:04:00 +02:00
|
|
|
And in recent months I've had difficulty sharing files p2p
|