Open dominic-p opened 5 years ago
const util = require("util");
const lfLock = util.promisify(lf.lock);
const lfUnlock = util.promisify(lf.unlock);
await lfLock('a', {retries: 60000, retryWait: 100});
await lfUnlock('a');
works fine.
Thanks for the confirmation. I have been using it with promisify as well. It would still be nice if Promises were supported natively in my opinion, but it's a huge deal since promisify works.
Considering the async API's do not have any special return value at this time, I believe it would be safe to add promise support as a non breaking change.
If callback is null, return a promise, else behave the way it currently does. Could potentially always return a promise even.
With Promises being available in Node for a while now, it would be great if this library could return Promises.
Side note: has anyone tried this with util.promsify? Does that work as expected?