simonlast / node-persist

Super-easy persistent data structures in Node.js
MIT License
719 stars 78 forks source link

await storage.init() returns an empty promise #120

Closed alexryd closed 5 years ago

alexryd commented 5 years ago

I noticed that the global init() function is not declared as async, which means running await storage.init() returns a Promise that resolves without actually waiting for the LocalStorage.init() function to resolve.

The callback argument of init() doesn't work either since it is passed to LocalStorage.init() that rather expects some options instead of a callback.

So the way init() is implemented now, there is no way to actually wait for the initialisation to complete before accessing the storage. Or am I missing something?

akhoury commented 5 years ago

no you're right, good catch.

akhoury commented 5 years ago

https://github.com/simonlast/node-persist/commit/a7a9060f799e3a3bad17a041b6500b56ac926ce3

published 3.0.5

alexryd commented 5 years ago

Great, thanks!