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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -