mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-09 18:28:08 +08:00
Cleanup coreunix cat
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
parent
ce20cf9954
commit
a7f43de5f2
@ -6,8 +6,7 @@ import (
|
||||
|
||||
cmds "github.com/ipfs/go-ipfs/commands"
|
||||
core "github.com/ipfs/go-ipfs/core"
|
||||
path "github.com/ipfs/go-ipfs/path"
|
||||
uio "github.com/ipfs/go-ipfs/unixfs/io"
|
||||
coreunix "github.com/ipfs/go-ipfs/core/coreunix"
|
||||
|
||||
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/cheggaaa/pb"
|
||||
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
|
||||
@ -68,12 +67,7 @@ func cat(ctx context.Context, node *core.IpfsNode, paths []string) ([]io.Reader,
|
||||
readers := make([]io.Reader, 0, len(paths))
|
||||
length := uint64(0)
|
||||
for _, fpath := range paths {
|
||||
dagnode, err := core.Resolve(ctx, node, path.Path(fpath))
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
read, err := uio.NewDagReader(ctx, dagnode, node.DAG)
|
||||
read, err := coreunix.Cat(node, fpath)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
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) {
|
||||
func Cat(n *core.IpfsNode, pstr string) (*uio.DagReader, error) {
|
||||
p := path.FromString(pstr)
|
||||
dagNode, err := n.Resolver.ResolvePath(n.Context(), p)
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user