apparat is a simple but powerful way to organize async code for nodejs
a simple yet powerful way to organize async code
npm install apparat
read domain from file
write resolved IPV4 addresses to
write resolved IPV6 addresses to
domain.txt when both files have been written successfully.
fs = require 'fs'dns = require 'dns'Apparat = require 'apparat'debug consolelogonError throw errfsreadFile 'domain.txt'send 'contents'receive 'contents'domain = contentstoStringtrim# paralleldnsresolve4 domainsend 'addresses4'dnsresolve6 domainsend 'addresses6'receive 'addresses4'fswriteFile 'adresses4.txt'addressesjoin'\n'send 'addresses4 written'receive 'addresses6'fswriteFile 'adresses6.txt'addressesjoin'\n'send 'addresses6 written'receive 'addresses4 written''addresses6 written'->fsunlink 'domain.txt'send 'deleted'receive 'deleted'->consolelog 'OK'