我用casperjs做了一個(gè)測(cè)試網(wǎng)頁(yè)加載速度的demo,然后想通過(guò)fs.write把結(jié)果打印在一張txt上,我加入了換行符'n'但是打印出來(lái)的東西依舊不會(huì)換行,代碼其中的一段類似這樣:var timeouttxt = '';function timeOutTxt() { if (timend > 800) { timeouttxt = 'Page Times is ' + timend + ' is timeout 800\n'; } else { timeouttxt = 'Page Times is ' + timend + '\n'; }}txtData += 'the links length: ' + links.length + '\n' + 'Page url is ' + this.getCurrentUrl() + '\n' + 'Page title is ' + this.getTitle() + ' index: ' + index + '\n' + timeouttxt + '-----------------------------------------------------\n';fs.write(file, txtData, function(err) { if (err) return err;});輸入出來(lái)的txt類似這樣:請(qǐng)教是什么原因?怎樣換行?謝謝
nodejs寫(xiě)入的文件無(wú)法換行
慕尼黑的夜晚無(wú)繁華
2018-10-10 17:15:17