From f654bac08a20cdbeddcdbecf89c92c2208ea06c7 Mon Sep 17 00:00:00 2001 From: shawn Date: Fri, 15 Mar 2024 14:55:30 +0800 Subject: [PATCH] feat: decrypt support api download --- core/commands/encrypt.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/core/commands/encrypt.go b/core/commands/encrypt.go index d9ef4a7f9..864881591 100644 --- a/core/commands/encrypt.go +++ b/core/commands/encrypt.go @@ -6,7 +6,6 @@ import ( "encoding/base64" "errors" "io" - "os" shell "github.com/bittorrent/go-btfs-api" cmds "github.com/bittorrent/go-btfs-cmds" @@ -143,17 +142,7 @@ var decryptCmd = &cmds.Command{ if err != nil { return errors.New("decryption is failed, maybe the content of encryption is not encrypted by your public key") } - fileName := "./decrypt-file-of-" + cid - f, err := os.Create(fileName) - if err != nil { - return err - } - defer f.Close() - _, err = f.Write(dedata) - if err != nil { - return err - } - return re.Emit("decrypted file name is: " + fileName) + return re.Emit(bytes.NewReader(dedata)) }, }