Unverified 提交 1dfc1f11 作者: jihao 提交者: GitHub

Update go-ipfs-api.go

上级 de42e717
......@@ -3,22 +3,28 @@ package main
import (
"bytes"
"fmt"
"strings"
shell "github.com/ipfs/go-ipfs-api"
)
func main() {
sh := shell.NewLocalShell()
cid, err := sh.Add(strings.NewReader("hello world! jihao gogo"))
if err != nil {
panic(err)
}
fmt.Println(cid)
// get block
blo,err:=sh.BlockGet("Qmaisz6NMhDB51cCvNWa1GMS7LU1pAxdF4Ld6Ft9kZEP2a")
if err !=nil{
blo, err := sh.BlockGet("QmXnSYWiLndBSK69gboyVAsgpvJf1aE1SEfw7Mq65heiNB")
if err != nil {
panic(err)
}
fmt.Println(string(blo))
// cat obj
obj,err:=sh.Cat("Qmaisz6NMhDB51cCvNWa1GMS7LU1pAxdF4Ld6Ft9kZEP2a")
if err !=nil {
obj, err := sh.Cat("Qmaisz6NMhDB51cCvNWa1GMS7LU1pAxdF4Ld6Ft9kZEP2a")
if err != nil {
panic(err)
}
var buf bytes.Buffer
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论