RangerMauve / hypercore-fetch

Implementation of Fetch that uses the Hyper SDK for loading p2p content
MIT License
37 stars 13 forks source link

Dedicated error code for rmdir on non-empty directory #34

Closed josephmturner closed 1 year ago

josephmturner commented 1 year ago

Does the new API makes this possible? https://docs.holepunch.to/building-blocks/hyperdrive#await-drive.del-path

RangerMauve commented 1 year ago

Just to clarify, do you want it to throw an error when trying to do a DELETE on an non-empty directory? Currently I think it just lets you delete directories recursively to simplify that use case.

josephmturner commented 1 year ago

By "currently", do you mean in hypercore 10?

With hypercore 9 (the current hyper-gateway), attempting to delete a non-empty directory gives a status 500 error.

josephmturner commented 1 year ago

If Hypercore 10 lets you recursively delete directories, then I'll probably just add a check in the application to warn users that the directory is not empty.

RangerMauve commented 1 year ago

By "currently" I mean hypercore9. I was under the impression that I got recursive directory deletes working, I guess I was wrong there.

Recursive deletes by default is something I'd like to have in the next version. 😅

Being able to do one delete on a dir instead of dozens of requests to do GET/DELETE is nice for UX IMO

josephmturner commented 1 year ago

Agreed. Ok, I'm glad recursive deletion will be in the next version!

josephmturner commented 1 year ago

Confirmed working in new version!