1
0
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:
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

@ -2,6 +2,8 @@ package commands
import (
"errors"
"io"
"strings"
cmds "github.com/jbenet/go-ipfs/commands"
)
@ -71,9 +73,9 @@ Resolve te value of another name:
return output, nil
},
Marshalers: cmds.MarshalerMap{
cmds.Text: func(res cmds.Response) ([]byte, error) {
cmds.Text: func(res cmds.Response) (io.Reader, error) {
output := res.Output().(string)
return []byte(output), nil
return strings.NewReader(output), nil
},
},
}