Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Use apicid.Hash instead of string in NodeListing.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevina committed Nov 7, 2018
1 parent cb4fb10 commit 9ca2c22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
uio "github.com/ipfs/go-unixfs/io"

cid "github.com/ipfs/go-cid"
apicid "github.com/ipfs/go-cidutil/apicid"
ipld "github.com/ipfs/go-ipld-format"
)

Expand Down Expand Up @@ -229,7 +230,7 @@ type NodeListing struct {
Name string
Type int
Size int64
Hash string
Hash apicid.Hash
}

func (d *Directory) ListNames(ctx context.Context) ([]string, error) {
Expand Down Expand Up @@ -274,7 +275,7 @@ func (d *Directory) ForEachEntry(ctx context.Context, f func(NodeListing) error)
child := NodeListing{
Name: l.Name,
Type: int(c.Type()),
Hash: nd.Cid().String(),
Hash: apicid.FromCid(nd.Cid()),
}

if c, ok := c.(*File); ok {
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
"hash": "QmRG3XuGwT7GYuAqgWDJBKTzdaHMwAnc1x7J2KHEXNHxzG",
"name": "go-path",
"version": "1.1.21"
},
{
"author": "kevina",
"hash": "QmeFSrmFz2ntaotQcPHmDK9NXN3Vyae1SR8g72N1ScPB9g",
"name": "go-cidutil",
"version": "0.2.0"
}
],
"gxVersion": "0.12.1",
Expand Down

0 comments on commit 9ca2c22

Please sign in to comment.