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-dms3
Commits
8637bbce
Commit
8637bbce
authored
Jan 22, 2018
by
ForrestWeston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs for coreapi unixfs method impls
License: MIT Signed-off-by:
ForrestWeston
<
forrest@protocol.ai
>
parent
600bd08a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
core/coreapi/unixfs.go
core/coreapi/unixfs.go
+5
-0
No files found.
core/coreapi/unixfs.go
View file @
8637bbce
...
...
@@ -14,6 +14,8 @@ import (
type
UnixfsAPI
CoreAPI
// Add builds a merkledag node from a reader, adds it to the blockstore,
// and returns the key representing that node.
func
(
api
*
UnixfsAPI
)
Add
(
ctx
context
.
Context
,
r
io
.
Reader
)
(
coreiface
.
Path
,
error
)
{
k
,
err
:=
coreunix
.
AddWithContext
(
ctx
,
api
.
node
,
r
)
if
err
!=
nil
{
...
...
@@ -26,6 +28,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, r io.Reader) (coreiface.Path, err
return
ParseCid
(
c
),
nil
}
// Cat returns the data contained by an IPFS or IPNS object(s) at path `p`.
func
(
api
*
UnixfsAPI
)
Cat
(
ctx
context
.
Context
,
p
coreiface
.
Path
)
(
coreiface
.
Reader
,
error
)
{
dagnode
,
err
:=
api
.
core
()
.
ResolveNode
(
ctx
,
p
)
if
err
!=
nil
{
...
...
@@ -41,6 +44,8 @@ func (api *UnixfsAPI) Cat(ctx context.Context, p coreiface.Path) (coreiface.Read
return
r
,
nil
}
// Ls returns the contents of an IPFS or IPNS object(s) at path p, with the format:
// `<link base58 hash> <link size in bytes> <link name>`
func
(
api
*
UnixfsAPI
)
Ls
(
ctx
context
.
Context
,
p
coreiface
.
Path
)
([]
*
coreiface
.
Link
,
error
)
{
dagnode
,
err
:=
api
.
core
()
.
ResolveNode
(
ctx
,
p
)
if
err
!=
nil
{
...
...
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