simulate file 2
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 50s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 50s
This commit is contained in:
parent
925ccc3b9e
commit
e265a66948
22
main.go
22
main.go
@ -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 {
|
||||||
@ -117,15 +116,24 @@ func main() {
|
|||||||
githubactions.Fatalf("Unable to create root dir path: %v", fmt.Errorf("%w", err))
|
githubactions.Fatalf("Unable to create root dir path: %v", fmt.Errorf("%w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
w, err := mwriter.CreateIpfsFilePart("blog/test.html")
|
w, err := mwriter.CreateIpfsFilePart("blog/index.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
githubactions.Fatalf("Unable to create index file part: %v", fmt.Errorf("%w", err))
|
githubactions.Fatalf("Unable to create index file part: %v", fmt.Errorf("%w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
fileReader, _ := os.Open("blog/test.html")
|
fileReader, _ := os.Open("blog/index.html")
|
||||||
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/index.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/index.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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user