1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-17 11:43:31 +08:00

commands: Changed Marshaler to return a io.Reader instead of a []byte

core/commands: Refactored command marshalers
This commit is contained in:
Matt Bell
2014-12-16 04:31:13 -08:00
parent 0395a7af1e
commit fd40702f73
19 changed files with 136 additions and 85 deletions

View File

@ -1,6 +1,9 @@
package commands
import (
"io"
"strings"
cmds "github.com/jbenet/go-ipfs/commands"
u "github.com/jbenet/go-ipfs/util"
)
@ -90,6 +93,6 @@ type MessageOutput struct {
Message string
}
func MessageTextMarshaler(res cmds.Response) ([]byte, error) {
return []byte(res.Output().(*MessageOutput).Message), nil
func MessageTextMarshaler(res cmds.Response) (io.Reader, error) {
return strings.NewReader(res.Output().(*MessageOutput).Message), nil
}