Closed knpwrs closed 1 year ago
There is a method for deleting the folder created _deleteLocation()
.
However, an in-memory only storage option might be nice. I'll look at how hard that might be to add.
Perhaps a generic storage provider interface.
I took a look and it will be more than just a little work to implement an in-memory option. I propose that if no directory is provided when it's instantiated, that it default to in-memory storage. I don't have time to do it just now, but maybe in the next week or so. Of course, if you do it yourself before then, I'll gladly accept a well coded and tested pull request.
A generic storage provider interface is a lot more work than even just adding an in-memory option. Again, I'd welcome a well coded and tested pull request for this if you're up for it.
https://github.com/gr2m/localstorage-memory might work for your usecase?
@nickcolley That looks nice but optional persistence would still be awesome.
It only requires a miniscule amount of work if mock-fs is used. You literally just require mock-fs in place of NodeJS's fs module and ensure the sole dependency of this project follows suit.
That is a good option. I'm using npm package write-file-atomic
for writes but that's only in one spot in the code and I could easily just check a conditional and use mock-fs
for that whenever it's in-memory mode. I'll put it on the list to try in the next week... unless you want to submit a pull request. ;-)
@LuminescentMoon 's idea is a really simple way to accomplish this. Anyone want to implement it and submit a pull request?
I would still love to do this if someone needs it.
Well, #76 would need something. I was thinking MySQL / Redis maybe combined with BroadcastChannel
Closing due to lack of interest
I think having the option of not persisting data would be helpful. I just need this for running unit-tests where data shouldn't persist past the current run.