PromiseToAsync
Convert promise or promisify function to async function.
The new async function will return [err, res]
, like nodejs callback style.
Install
npm install promise-to-async --save
Example
; async { const promise = Promise; const err res = await ; console; console;}; async { const util = ; const fs = ; const promise = util'/'; const err res = await ;};// same asasync { const util = ; const fs = ; const readdir = ; const err res = await ;};
Or by inject.
;// injectPromiseToAsync; // method name default is two async { const promise = Promise; const err res = await promise; console; console;};