simulate file 2
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled

This commit is contained in:
Alexandre Bruyant 2024-01-07 18:44:08 +01:00
parent 925ccc3b9e
commit 6b5a0a4277

18
main.go
View File

@ -14,10 +14,9 @@ import (
) )
type AddResponse struct { type AddResponse struct {
Bytes int64 Hash string
Hash string Name string
Name string Size string
Size string
} }
type IpfsMultipartWriter struct { type IpfsMultipartWriter struct {
@ -126,6 +125,15 @@ func main() {
defer fileReader.Close() defer fileReader.Close()
io.Copy(w, fileReader) 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 { // err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
// if err != nil { // if err != nil {
// return err // return err
@ -177,7 +185,7 @@ func main() {
var ipfsAddResponse AddResponse var ipfsAddResponse AddResponse
json.Unmarshal(resBody, &ipfsAddResponse) 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.Infof("CID is %v", ipfsAddResponse.Hash)
githubactions.SetOutput("cid", ipfsAddResponse.Hash) githubactions.SetOutput("cid", ipfsAddResponse.Hash)
} }