nodejs fs读取静态json文件

let fs = require('fs'),
stream = fs.createReadStream('./obd.json'),
data = ""; stream.on('data',function(params){ console.log(params); console.log(params.toString()); data += params; }); stream.on('end',function(){ console.log(data); console.log(data.toString()); console.log('finished!!!!'); });

 

posted @ 2018-03-22 11:38  黑夜蓝天  阅读(504)  评论(0编辑  收藏  举报