Open 2color opened 2 months ago
It seems that this is also the case for fs.addBytes
which doesn't respect wrapWithDirectory
From @achingbrain
I’m not sure, I think maybe? The method is
addFile
, which it does, but if we don’t return a directory wrapper the filename is ignored. Since we’re acceptingwrapWithDirectory
, we should honour that and return the CID for the directory. Should we do this anyway if a path is supplied? What about a deeply nested path?I guess the most obvious thing to do is to:
- wrap the output in a directory if
wrapWithDirectory
is passed- wrap the output in a directory if a path is passed
- deeply nest the output if a deeply nested path is passed
What if we pass a nested path and
wrapWithDirectory
? Do we ignorewrapWith..
since the returned CID would be the outermost directory anyway?
Since we’re accepting wrapWithDirectory, we should honour that and return the CID for the directory.
👍
I guess the most obvious thing to do is to:
- wrap the output in a directory if
wrapWithDirectory
is passed- wrap the output in a directory if a path is passed
- deeply nest the output if a deeply nested path is passed
Makes sense to me
What if we pass a nested path and wrapWithDirectory? Do we ignore wrapWith.. since the returned CID would be the outermost directory anyway?
Also makes sense to me.
Given the following code:
The
fs.addFile
returns a raw CID (bafkreihocdnev37gdi356hposn6kgiq27i5sgupz5i2o3o5xnfltyz4f64
and does not wrap the added file in a directory.