草庐IT

onGotData

全部标签

node.js - 在 Node.js 中加载 html 页面

如何使用NodeJs加载HTML页面? 最佳答案 此代码应从html页面加载数据。varhttp=require('http');http.get('http://www.google.com',onGotData);functiononGotData(res){varchunks=[];res.on('data',onGotData);res.on('end',onEnd);functiononGotData(chunk){chunks.push(chunk);}functiononEnd(){console.log(chunks