From ee45dafe78299ac3356a3a49b4ff63cac4c3530d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Oct 2018 22:30:45 +0200 Subject: [PATCH] coreapi unixfs: wrap option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Ɓukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@b977abfc696b22775fa68736c144760113b27af4 This commit was moved from ipfs/boxo@59fd418b398d9011c79167b82af869751acf2640 --- core/coreiface/options/unixfs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index df6f4fc71..abbea9681 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -31,6 +31,8 @@ type UnixfsAddSettings struct { Pin bool OnlyHash bool Local bool + + Wrap bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -51,6 +53,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, Pin: false, OnlyHash: false, Local: false, + + Wrap: false, } for _, opt := range opts { @@ -202,3 +206,12 @@ func (unixfsOpts) Local(local bool) UnixfsAddOption { 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 + } +}