holepunchto / hyperdrive

Hyperdrive is a secure, real time distributed file system
Apache License 2.0
1.86k stars 135 forks source link

recursive rmdir #311

Closed heapwolf closed 2 years ago

heapwolf commented 3 years ago

In this PR I added tests for rmdir (there were none). I also allow an options object to be threaded through rmdir to the readdirIterator. This allows us to do...

drive.rmdir('beep', { recursive: true }, cb)

await drive.promises.rmdir('/boop', { recursive: true })
pfrazee commented 3 years ago

I'm not conversant with this codebase but the PR includes tests and seems fine, @mafintosh or @andrewosh can you give a quick review or comment?

mafintosh commented 3 years ago

Looks fine to me. Obvs not atomic but neither is it on a file system

andrewosh commented 3 years ago

Hey @Raynos @heapwolf, you mentioned there might be a few more things to add to this PR before it's ready to merge? From the state of things currently, it all looks ready to go.

@heapwolf mentioned adding cp and mv to the API. cp definitely would be a good addition which we're happy to add, but mv has issues that have blocked us in the past. We'll want the moves to be atomic, and Hypertrie doesn't support atomically renaming directories.

Could we get your changes merged without mv?

heapwolf commented 2 years ago

I moved this into #321 and includes a few more things