mirror of
https://github.com/ipfs/kubo.git
synced 2025-05-21 08:56:37 +08:00
commands: Changed Marshaler to return a io.Reader instead of a []byte
core/commands: Refactored command marshalers
This commit is contained in:
@ -4,6 +4,7 @@ package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -134,11 +135,11 @@ baz
|
||||
},
|
||||
Type: &config.Mounts{},
|
||||
Marshalers: cmds.MarshalerMap{
|
||||
cmds.Text: func(res cmds.Response) ([]byte, error) {
|
||||
cmds.Text: func(res cmds.Response) (io.Reader, error) {
|
||||
v := res.Output().(*config.Mounts)
|
||||
s := fmt.Sprintf("IPFS mounted at: %s\n", v.IPFS)
|
||||
s += fmt.Sprintf("IPNS mounted at: %s\n", v.IPNS)
|
||||
return []byte(s), nil
|
||||
return strings.NewReader(s), nil
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user