What does arg "wrap_with_directory" from add function do?

There’s an argument called wrap_with_directory within the add function from the ipfsapi (here in code). The description says:

wrap_with_directory : bool
            Wrap files with a directory object to preserve their filename
            (Default: ``False``)

I’m not exactly sure what this means.
My guess: Does it place files into a container directory before uploading?
Whatever the function is, what kind of use cases are there?

1 Like

Yes. This is essentially what it does.

The use case is if you want to preserve the filenames of individual files you’re adding to IPFS that aren’t already in a directory.

1 Like

As opposed to uploading files directly without wrapping into a folder, because that file would just get addressed by its hash on IPFS?

I’m presuming it goes like this:

[->]: Upload onto IPFS

wrap_with_directory: false
  file.txt -> <IPFS hash>
wrap_with_directory: true
  foldername/file.txt -> <IPFS hash>/file.txt
1 Like

That’s correct!

<This post must be at least 20 characters>

1 Like