Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 0b24a16

Browse files
authored
Merge pull request #103 from ipfs/feat/block-put-options
Add options to block put
2 parents f1ca0ef + 27d57c5 commit 0b24a16

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shell.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ func (s *Shell) BlockGet(path string) ([]byte, error) {
674674
return ioutil.ReadAll(resp.Output)
675675
}
676676

677-
func (s *Shell) BlockPut(block []byte) (string, error) {
677+
func (s *Shell) BlockPut(block []byte, format, mhtype string, mhlen int) (string, error) {
678678
data := bytes.NewReader(block)
679679
rc := ioutil.NopCloser(data)
680680
fr := files.NewReaderFile("", "", rc, nil)
@@ -683,6 +683,11 @@ func (s *Shell) BlockPut(block []byte) (string, error) {
683683

684684
req := s.newRequest(context.Background(), "block/put")
685685
req.Body = fileReader
686+
req.Opts = map[string]string{
687+
"mhtype": mhtype,
688+
"mhlen": fmt.Sprintf("%d", mhlen),
689+
"format": format,
690+
}
686691
resp, err := req.Send(s.httpcli)
687692
if err != nil {
688693
return "", err

0 commit comments

Comments
 (0)