From 071744db88cf24596120b18eb159735763152aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Tue, 16 May 2023 17:00:27 +0200 Subject: [PATCH] add: support for wrap-with-directory --- add.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/add.go b/add.go index f736cef54..504ee3fdd 100644 --- a/add.go +++ b/add.go @@ -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)