Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
77ff92dc
Commit
77ff92dc
authored
Apr 15, 2021
by
Cory Schwartz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
io/dagreader.go
parent
68c015a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
io/dagreader.go
io/dagreader.go
+19
-1
No files found.
io/dagreader.go
View file @
77ff92dc
...
...
@@ -56,9 +56,27 @@ func NewDagReader(ctx context.Context, n ipld.Node, serv ipld.NodeGetter) (DagRe
}
switch
fsNode
.
Type
()
{
case
unixfs
.
TFile
,
unixfs
.
TRaw
:
case
unixfs
.
TFile
:
size
=
fsNode
.
FileSize
()
case
unixfs
.
TRaw
:
stat
,
err
:=
n
.
Stat
()
if
err
!=
nil
{
return
nil
,
err
}
size
=
uint64
(
stat
.
DataSize
)
for
_
,
link
:=
range
n
.
Links
()
{
ln
,
err
:=
link
.
GetNode
(
ctx
,
serv
)
if
err
!=
nil
{
return
nil
,
err
}
stat
,
err
:=
ln
.
Stat
()
if
err
!=
nil
{
return
nil
,
err
}
size
+=
uint64
(
stat
.
DataSize
)
}
case
unixfs
.
TDirectory
,
unixfs
.
THAMTShard
:
// Dont allow reading directories
return
nil
,
ErrIsDir
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment