From 6b5a0a4277a8059fa311bb2552869450b14529fb Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sun, 7 Jan 2024 18:44:08 +0100 Subject: [PATCH] simulate file 2 --- main.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index fd4649a..c868385 100644 --- a/main.go +++ b/main.go @@ -14,10 +14,9 @@ import ( ) type AddResponse struct { - Bytes int64 - Hash string - Name string - Size string + Hash string + Name string + Size string } type IpfsMultipartWriter struct { @@ -126,6 +125,15 @@ func main() { defer fileReader.Close() io.Copy(w, fileReader) + w, err = mwriter.CreateIpfsFilePart("blog/posts/hosting-static-site-on-ipfs/test.html") + if err != nil { + githubactions.Fatalf("Unable to create index file part: %v", fmt.Errorf("%w", err)) + } + + fileReader2, _ := os.Open("blog/posts/hosting-static-site-on-ipfs/test.html") + defer fileReader2.Close() + io.Copy(w, fileReader2) + // err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error { // if err != nil { // return err @@ -177,7 +185,7 @@ func main() { var ipfsAddResponse AddResponse json.Unmarshal(resBody, &ipfsAddResponse) - githubactions.Infof("Upload size is %v", ipfsAddResponse.Bytes) + githubactions.Infof("Upload size is %v", ipfsAddResponse.Size) githubactions.Infof("CID is %v", ipfsAddResponse.Hash) githubactions.SetOutput("cid", ipfsAddResponse.Hash) }