mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 19:44:01 +08:00
19 lines
391 B
Go
19 lines
391 B
Go
package coreunix
|
|
|
|
import (
|
|
"io"
|
|
|
|
core "github.com/ipfs/go-ipfs/core"
|
|
path "github.com/ipfs/go-ipfs/path"
|
|
uio "github.com/ipfs/go-ipfs/unixfs/io"
|
|
)
|
|
|
|
func Cat(n *core.IpfsNode, pstr string) (io.Reader, error) {
|
|
p := path.FromString(pstr)
|
|
dagNode, err := n.Resolver.ResolvePath(n.Context(), p)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return uio.NewDagReader(n.Context(), dagNode, n.DAG)
|
|
}
|