nl_tokens: a hack suggested here : https : // github . com / amir20 / phantomjs - node / issues / 292
pl_tokens: function checkForData ( ) { ph . windowProperty ( "DATA" ) . then ( function ( <mask> ) { if ( data !== undefined ) { writeToFile ( data ) ; ph . exit ( ) ; } else { setTimeout ( checkForData , 100 ) ; } } ) ; }