mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-22 12:51:19 +08:00
coreapi unixfile: simplify RawNode case
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
@ -1,11 +1,9 @@
|
||||
package coreapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
gopath "path"
|
||||
"time"
|
||||
@ -172,12 +170,6 @@ func newUnixfsFile(ctx context.Context, dserv ipld.DAGService, nd ipld.Node, nam
|
||||
}
|
||||
|
||||
case *dag.RawNode:
|
||||
r := ioutil.NopCloser(bytes.NewReader(dn.RawData()))
|
||||
fi := &sizeInfo{
|
||||
size: int64(len(dn.RawData())),
|
||||
}
|
||||
|
||||
return files.NewReaderFile("", "", r, fi), nil
|
||||
default:
|
||||
return nil, errors.New("unknown node type")
|
||||
}
|
||||
|
Reference in New Issue
Block a user