promisify a function has More than two params
See original GitHub issuev1.11
promisify a function that callback function has More than two params
e.q.
const { exec } = require('child_process');
const exec_1 = require('util').promisify(exec);
const exec_2 = require('aigle').promisify(exec);
const cmd = 'ls 1>&2';
exec_1(cmd).then(raw=> console.log('exec 1=>',raw)).catch(e=>console.log('exec 1 error=>',e));
exec_2(cmd).then(raw=> console.log('exec 2=>',raw)).catch(e=>console.log('exec 2 error=>',e));
.result
exec 1 => { stdout: '', stderr: 'a.file'}
exec 2 =>
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
NodeJs: util.promisify where the callback function has multiple ...
It turns multiple arguments of callback into an array. So, in my case for MySQL's query that the default callback has 3 arguments...
Read more >`promisify()` behavior with multiple parameters can break ...
Current behavior of promisify is to resolve to an array when there is more than one result to the callback. Unfortunately, if a...
Read more >Promisification - The Modern JavaScript Tutorial
Here, promisify assumes that the original function expects a callback with exactly two arguments (err, result) . That's what we encounter ...
Read more >Passing multiple arguments in promises - Gleb Bahmutov
We are using Q.all method to execute multiple promises in parallel and get a single promise back that resolves with an array. The...
Read more >How to pass multiple arguments to Promise.resolve - JavaScript
I am trying to learn JS Promise. I have the following function which returns either the sum or difference of two numbers depending...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I published it on
v1.12.0
!@HoKangInfo @thammin Thanks for the issue, it is so helpful! Yes, let’s support it! 😄
Sure, we need to handle it. 👍