coreapi unixfs: wrap option
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@b977abfc696b22775fa68736c144760113b27af4 This commit was moved from ipfs/boxo@59fd418b398d9011c79167b82af869751acf2640
Łukasz Magiera committed
Oct 3, 2018 at 22:30 UTC
ee45dafe78299ac3356a3a49b4ff63cac4c3530d
1 file changed
+13
core/coreiface/options/unixfs.go
+13
@@ -31,6 +31,8 @@ type UnixfsAddSettings struct {
31
Pin bool
32
OnlyHash bool
33
Local bool
34
+
35
+ Wrap bool
36
}
37
38
type UnixfsAddOption func(*UnixfsAddSettings) error
@@ -51,6 +53,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
53
Pin: false,
54
OnlyHash: false,
55
Local: false,
56
+
57
+ Wrap: false,
58
}
59
60
for _, opt := range opts {
@@ -202,3 +206,12 @@ func (unixfsOpts) Local(local bool) UnixfsAddOption {
206
return nil
207
}
208
}
209
+
210
+// Wrap tells the adder to wrap the added file structure with an additional
211
+// directory.
212
+func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption {
213
+ return func(settings *UnixfsAddSettings) error {
214
+ settings.Wrap = wrap
215
+ return nil
216
+ }
217
+}