helia icon indicating copy to clipboard operation
helia copied to clipboard

Helia UnixFs `addFile` does not respect `wrapWithDirectory`

Open 2color opened this issue 10 months ago • 3 comments

Given the following code:

const helia = await createHelia()
const fs = unixfs(helia)

const cid = await fs.addFile({
  path: 'index.html',
  content: Uint8Array.from([4, 3, 2, 1])
}, {
  wrapWithDirectory: true
})

console.log(cid) // CID(bafkreihocdnev37gdi356hposn6kgiq27i5sgupz5i2o3o5xnfltyz4f64)

The fs.addFile returns a raw CID (bafkreihocdnev37gdi356hposn6kgiq27i5sgupz5i2o3o5xnfltyz4f64 and does not wrap the added file in a directory.

2color avatar Apr 19 '24 11:04 2color