dreymonde/Shallows

No mechanism for deleting from disk storage

Closed this issue · 1 comments

I really like this very thin, simple storage layer, also props for dropping support for legacy package management systems!

I may be missing something, but is there no way to remove a single item from disk storage? Something like storage.delete(Key)?

Update: It looks like there is DiskStorage.fileURL(for:) but that requires me to manually create the filename again (if I've mapped it to a different type)

Hi @GeorgeLyon

Sorry for keeping this so long without response! Yes, sadly there is no built-in way to remove a file from disk. Your hunch about using DiskStorage.fileURL(for:) is correct for this task, and yup, it probably will require some manual recreating of Filename (although it's pretty much just a simple String wrapper) if you mapped the key.

Agree that it's inconvenient, but sadly when you try to make very generic abstractions like in Shallows, something will be lost in the process.

Closing this for now, but let me know if you have any ideas about how to improve this!