/** * basic usage of bluebird */ var Promise = require("bluebird"); //defining an async function var cl = function () { setTimeout(function () { console.log('Write something'); }, 2500); }; //promisifing a function (attaching then() method) var clAsync = Promise.promisifyAll(cl); console.log(JSON.stringify(clAsync, null, 2)); //executing promisified function clAsync() and adding new callback with then method clAsync() .then(function () { console.log('Write again'); }) .catch(function (e) { console.error(e.stack); });
$ps -aux | grep node (list all node processes) sasa 849 0.5 0.5 1319424 87724 ? Ssl Oct08 283:27 node /home/sasa/regoch/regoch-www/server sasa 880 0.4 0.5 1319240 87480 ? Ssl Oct08 235:55 node /home/sasa/dex8/dex8-www/server/index.js sasa 890 0.5 0.5 11797800 85208 ? Ssl Oct08 334:45 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js sasa 903 0.7 0.4 1329652 81676 ? Ssl Oct08 431:23 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js sasa 929 0.4 0.4 1300184 68840 ? Ssl Oct08 226:28 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js sasa 943 0.4 0.4 1300808 66672 ? Ssl Oct08 233:34 node /home/sasa/dex8/dex8-kiosk/server/index.js sasa 980 0.6 0.4 11795444 81508 ? Ssl Oct08 365:00 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js sasa 981 0.7 0.6 1148036 104916 ? Ssl Oct08 395:23 node /home/sasa/voovuu/voovuu-api/starter.js sasa 1039 0.9 1.4 11945524 245956 ? Ssl Oct08 555:28 node /home/sasa/voovuu/voovuu-pub/server/index.js sasa 2044488 0.3 0.4 1298112 66884 ? Ssl Nov01 77:34 node /home/sasa/dex8/dex8-panel/server/index.js sasa 2574087 0.3 0.4 11792920 77148 ? Ssl Nov08 42:10 node /home/sasa/@mikosoft/dodo-examples/server/index.js sasa 2702010 0.4 0.6 22296696 100092 ? Ssl Nov10 35:20 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702011 0.3 0.4 1100276 66260 ? Ssl Nov10 31:28 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702018 0.3 0.4 1099884 66276 ? Ssl Nov10 31:31 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702019 0.3 0.4 1100516 66852 ? Ssl Nov10 31:29 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702046 0.9 0.7 22311780 123532 ? Ssl Nov10 84:36 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702047 0.3 0.3 1100260 65588 ? Ssl Nov10 31:46 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702088 0.3 0.4 1100264 66020 ? Ssl Nov10 31:30 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702089 0.3 0.4 1100264 66900 ? Ssl Nov10 31:27 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702137 0.3 0.4 1099864 65948 ? Ssl Nov10 31:18 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702139 0.4 0.6 22297196 101400 ? Ssl Nov10 35:51 node /home/sasa/dex8/dex8-worker/starter.js sasa 3097623 1.1 0.8 11716736 131208 ? Ssl Nov13 44:30 node /home/sasa/dex8/dex8-api/starter.js www-data 3369265 0.0 0.0 2608 596 ? S 09:31 0:00 sh -c ps -aux | grep node www-data 3369267 0.0 0.0 3304 728 ? S 09:31 0:00 grep node