Commit b977abfc authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi unixfs: wrap option

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 7b2fdc90
...@@ -31,6 +31,8 @@ type UnixfsAddSettings struct { ...@@ -31,6 +31,8 @@ type UnixfsAddSettings struct {
Pin bool Pin bool
OnlyHash bool OnlyHash bool
Local bool Local bool
Wrap bool
} }
type UnixfsAddOption func(*UnixfsAddSettings) error type UnixfsAddOption func(*UnixfsAddSettings) error
...@@ -51,6 +53,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, ...@@ -51,6 +53,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
Pin: false, Pin: false,
OnlyHash: false, OnlyHash: false,
Local: false, Local: false,
Wrap: false,
} }
for _, opt := range opts { for _, opt := range opts {
...@@ -202,3 +206,12 @@ func (unixfsOpts) Local(local bool) UnixfsAddOption { ...@@ -202,3 +206,12 @@ func (unixfsOpts) Local(local bool) UnixfsAddOption {
return nil return nil
} }
} }
// Wrap tells the adder to wrap the added file structure with an additional
// directory.
func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption {
return func(settings *UnixfsAddSettings) error {
settings.Wrap = wrap
return nil
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment