/** * basic usage of bluebird */ var Promise = require("bluebird"); var fs = Promise.promisifyAll(require("fs")); console.log(JSON.stringify(fs, null, 2)); fs.readFileAsync("../testfiles/readMe.txt", "utf8") .then(function (fileContent) { console.log(fileContent); return fs.readFileAsync("badFile.txt", "utf8") .then(function () { console.log('Second file is tried to read.'); }); }) .then(function () { console.log('Finished!!!'); }) .catch(function (e) { console.error(e.stack); });
$ps -aux | grep node (list all node processes) sasa 849 0.5 0.5 1319424 88296 ? Ssl Oct08 283:32 node /home/sasa/regoch/regoch-www/server sasa 880 0.4 0.5 1319240 87448 ? Ssl Oct08 235:58 node /home/sasa/dex8/dex8-www/server/index.js sasa 890 0.5 0.5 11797800 85448 ? Ssl Oct08 334:50 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js sasa 903 0.7 0.5 1329652 82252 ? Ssl Oct08 431:30 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js sasa 929 0.4 0.4 1300184 68852 ? Ssl Oct08 226:31 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js sasa 943 0.4 0.4 1300808 66824 ? Ssl Oct08 233:37 node /home/sasa/dex8/dex8-kiosk/server/index.js sasa 980 0.6 0.4 11795444 81884 ? Ssl Oct08 365:05 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js sasa 981 0.7 0.6 1148036 103992 ? Ssl Oct08 395:28 node /home/sasa/voovuu/voovuu-api/starter.js sasa 1039 0.9 1.5 11947012 248016 ? Ssl Oct08 555:33 node /home/sasa/voovuu/voovuu-pub/server/index.js sasa 2044488 0.3 0.4 1298112 67024 ? Ssl Nov01 77:37 node /home/sasa/dex8/dex8-panel/server/index.js sasa 2574087 0.3 0.4 11792920 76992 ? Ssl Nov08 42:14 node /home/sasa/@mikosoft/dodo-examples/server/index.js sasa 2702010 0.4 0.6 22296696 99728 ? Ssl Nov10 35:24 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702011 0.3 0.4 1100276 66504 ? Ssl Nov10 31:31 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702018 0.3 0.4 1100396 66072 ? Ssl Nov10 31:34 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702019 0.3 0.4 1100516 66720 ? Ssl Nov10 31:33 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702046 0.9 0.7 22311780 123952 ? Ssl Nov10 84:39 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702047 0.3 0.4 1100516 66212 ? Ssl Nov10 31:50 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702088 0.3 0.4 1100520 65688 ? Ssl Nov10 31:34 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702089 0.3 0.4 1100520 66612 ? Ssl Nov10 31:31 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702137 0.3 0.4 1099864 66404 ? Ssl Nov10 31:21 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702139 0.4 0.6 22297196 101288 ? Ssl Nov10 35:55 node /home/sasa/dex8/dex8-worker/starter.js sasa 3097623 1.1 0.8 11716736 131824 ? Ssl Nov13 44:35 node /home/sasa/dex8/dex8-api/starter.js www-data 3370241 0.0 0.0 2608 604 ? S 09:47 0:00 sh -c ps -aux | grep node www-data 3370243 0.0 0.0 3304 728 ? S 09:47 0:00 grep node