示意圖
學習目標
- Node-1 與 Node-2 之間檔案傳輸測試
前置準備作業
一台能上網的電腦
已建立完成 Node-1 與 Node-2 的 IPFS 安裝與設定
測試 IPFS
《 Node-1
》
Step 1. 在 Node-1 中產生內容為 test Hello World 的 mytextfile.txt 文字檔
❖ 在【 終端機 (macOS) / Putty (Windows) 】輸入下方指令
echo "test Hello World" > mytextfile.txt
Step 2. 將 mytextfile.txt 檔案加到 IPFS
❖ 在【 終端機 (macOS) / Putty (Windows) 】輸入下方指令
ipfs add mytextfile.txt
㊟ 可看到 mytextfile.txt 的 Hash 值
《 Node-2
》
Step 1. 取得 mytextfile.txt 檔案內容
❖ 在【 終端機 (macOS) / Putty (Windows) 】輸入下方指令
ipfs cat 檔案的Hash
例如 : ipfs cat Qmc8uDkHxSCq5JZA7vs56goHRV7acWNd4iZADrHx77n3H2