Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

21.5. Infura IPFS

21.5.1. 上傳檔案

			
neo@MacBook-Pro /tmp % cat hello.txt 
http://www.netkiller.cn

neo@MacBook-Pro /tmp % curl "https://ipfs.infura.io:5001/api/v0/add?pin=false" \
    -X POST \
    -H "Content-Type: multipart/form-data" \
    -F file=@"hello.txt"          
{"Name":"hello.txt","Hash":"QmToi4pgQH4LQX8wGMt5H8EV2dA7hD8S2EccRpd8YGUgac","Size":"32"}
			
			

21.5.2. 查看檔案

			
neo@MacBook-Pro /tmp % curl "https://ipfs.infura.io:5001/api/v0/cat?arg=QmToi4pgQH4LQX8wGMt5H8EV2dA7hD8S2EccRpd8YGUgac" 
http://www.netkiller.cn
			
			

21.5.3. 下載檔案

			
neo@MacBook-Pro /tmp % curl -s "https://ipfs.infura.io:5001/api/v0/get?arg=QmToi4pgQH4LQX8wGMt5H8EV2dA7hD8S2EccRpd8YGUgac&archive=true" -o hello.tgz

neo@MacBook-Pro /tmp % tar zxvf hello.tgz 
x QmToi4pgQH4LQX8wGMt5H8EV2dA7hD8S2EccRpd8YGUgac

neo@MacBook-Pro /tmp % cat QmToi4pgQH4LQX8wGMt5H8EV2dA7hD8S2EccRpd8YGUgac
http://www.netkiller.cn			
			
			

21.5.4. 創建目錄

			
neo@MacBook-Pro /tmp % curl "https://ipfs.infura.io:5001/api/v0/files/mkdir?arg=/netkiller"

neo@MacBook-Pro /tmp % curl "https://ipfs.infura.io:5001/api/v0/files/stat?arg=/netkiller"        
{"Hash":"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn","Size":0,"CumulativeSize":4,"Blocks":0,"Type":"directory"}			
			
			

21.5.5. 查看檔案狀態

			
neo@MacBook-Pro /tmp % curl "https://ipfs.infura.io:5001/api/v0/files/stat?arg=/netkiller"        
{"Hash":"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn","Size":0,"CumulativeSize":4,"Blocks":0,"Type":"directory"}			
			
			

21.5.6. 查看IPFS版本號

			
neo@MacBook-Pro ~/workspace % curl "https://ipfs.infura.io:5001/api/v0/version"
{"Version":"0.4.14","Commit":"","Repo":"6","System":"amd64/linux","Golang":"go1.10"}