Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alvin-reyes committed Dec 1, 2022
1 parent 107d192 commit d7552e3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ go get github.com/application-research/whypfs-core

## Setup a node
```
p1, err := p1, err1 := NewNode(NewNodeParams{Ctx: context.Background()})
peer, err := NewNode(NewNodeParams{Ctx: context.Background()})
if err != nil {
t.Fatal(err)
}
```

## Add/Pin and Get a file
```
node, err := p1.AddPinFile(context.Background(), bytes.NewReader([]byte("letsrebuildtolearnnewthings!")), nil)
content, err := p1.GetFile(context.Background(), node.Cid())
node, err := peer.AddPinFile(context.Background(), bytes.NewReader([]byte("letsrebuildtolearnnewthings!")), nil)
content, err := peer.GetFile(context.Background(), node.Cid())
```

## Add/Pin Directory and Get the ipld.Node of the directory
```
node, err := p1.AddPinDirectory(context.Background(), "./test/test_directory")
mainDirNode, err := p1.GetDirectory(context.Background(), node)
node, err := peer.AddPinDirectory(context.Background(), "./test/test_directory")
mainDirNode, err := peer.GetDirectory(context.Background(), node)
```

## Provides
Expand Down

0 comments on commit d7552e3

Please sign in to comment.