1
0
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:
Łukasz Magiera
2018-10-04 04:07:22 +02:00
parent 69eb015b9f
commit 051c33087b

View File

@ -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")
}