node.js - Async to sync in nodejs -
i using library getmac mac address of server on nodejs running. api mac address async want use sync call. possible without using libraries sync, deasync etc?
//async api require('getmac').getmac(function(err,macaddress){ if (err) throw err console.log(macaddress) })
you can use package
var done = false; require('getmac').getmac(function(err,macaddress) { if (err) throw err console.log(macaddress) done = true; }); require('deasync').loopwhile(function(){return !done;});
Comments
Post a Comment