1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00
Files
kubo/core/coreunix/cat.go
Jeromy 0597a04924 Fix sharding memory growth, and fix resolver for unixfs paths
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2017-04-30 13:48:28 -07:00

24 lines
482 B
Go

package coreunix
import (
"context"
core "github.com/ipfs/go-ipfs/core"
path "github.com/ipfs/go-ipfs/path"
uio "github.com/ipfs/go-ipfs/unixfs/io"
)
func Cat(ctx context.Context, n *core.IpfsNode, pstr string) (uio.DagReader, error) {
r := &path.Resolver{
DAG: n.DAG,
ResolveOnce: uio.ResolveUnixfsOnce,
}
dagNode, err := core.Resolve(ctx, n.Namesys, r, path.Path(pstr))
if err != nil {
return nil, err
}
return uio.NewDagReader(ctx, dagNode, n.DAG)
}