mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-11 13:29:12 +00:00
22 lines
386 B
Go
22 lines
386 B
Go
|
package ipfs
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/ipfs/boxo/files"
|
||
|
)
|
||
|
|
||
|
type Folder = files.Directory
|
||
|
|
||
|
func NewFolder(fs ...File) Folder {
|
||
|
return files.NewMapDirectory(convertFilesToMap(fs))
|
||
|
}
|
||
|
|
||
|
func (c *client) AddFolder(folder Folder) (string, error) {
|
||
|
cidFile, err := c.api.Unixfs().Add(context.Background(), folder)
|
||
|
if err != nil {
|
||
|
return "", err
|
||
|
}
|
||
|
return cidFile.String(), nil
|
||
|
}
|