Skip to content

Instantly share code, notes, and snippets.

@mrosset
Created October 20, 2017 14:47
Show Gist options
  • Save mrosset/747f0cf58c4fa2221fd819035d8bfa8e to your computer and use it in GitHub Desktop.
Save mrosset/747f0cf58c4fa2221fd819035d8bfa8e to your computer and use it in GitHub Desktop.
func AddR(path string) (string, error) {
r, err := fsrepo.Open(Path("$HOME/.ipfs").String())
if err != nil {
return "", err
}
node, err := core.NewNode(context.TODO(), &core.BuildCfg{
Repo: r,
})
if err != nil {
return "", err
}
bserv := blockservice.New(node.Blockstore, node.Exchange)
dserv := merkledag.NewDAGService(bserv)
return BaseAddR(node, path, dserv)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment