Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

add: support for wrap-with-directory #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions add.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ func CidVersion(version int) AddOpts {
}
}

// WrapWithDirectory allows for wrapping files with a root directory object.
func WrapWithDirectory(enabled bool) AddOpts {
return func(rb *RequestBuilder) error {
rb.Option("wrap-with-directory", enabled)
return nil
}
}

// Add adds a file to ipfs pinning it with the given options
func (s *Shell) Add(r io.Reader, options ...AddOpts) (string, error) {
fr := files.NewReaderFile(r)
Expand Down