go-ipfs-api icon indicating copy to clipboard operation
go-ipfs-api copied to clipboard

Support `wrap-with-directory` Option

Open channprj opened this issue 6 years ago • 5 comments

Example

func Wrap(enabled bool) ipfs.AddOpts {
	return func(rb *ipfs.RequestBuilder) error {
		rb.Option("wrap-with-directory", enabled)
		return nil
	}
}

channprj avatar Apr 17 '19 07:04 channprj

FYI, you might want to try the new https://github.com/ipfs/go-ipfs-http-client instead. It's not quite stable but has more features.

Stebalien avatar Apr 17 '19 17:04 Stebalien

@Stebalien Thanks. ☺️ May I ask what is different between go-ipfs-api and go-ipfs-http-client? Can I use the -w option?

channprj avatar Apr 22 '19 08:04 channprj

@Stebalien Thanks. relaxed May I ask what is different between go-ipfs-api and go-ipfs-http-client?

go-ipfs-http-client is intended to replace this library.

Can I use the -w option?

With this library, you'll have to add that option. With go-ipfs-http-client, you'd call:

Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{
  "filename": files.NewReaderFile(myFile)
})

Stebalien avatar Apr 22 '19 17:04 Stebalien

@Stebalien Thank you. I'll try it ASAP. 🚀

channprj avatar Apr 23 '19 01:04 channprj

I think someone already raised PR. I think this can be linked with the PR.

https://github.com/ipfs/go-ipfs-api/pull/294

susarlanikhilesh avatar Jun 04 '23 08:06 susarlanikhilesh