nodejs常见的读取文件内容的方法
by 伍雪颖
var fs = require('fs'); var rs = fs.createReadStream('test.md'); var data = ''; rs.on("data",function(chunk) { data += chunk; }); rs.on("end",function() { console.log(data); });
时间: 2024-12-24 09:12:21
by 伍雪颖
var fs = require('fs'); var rs = fs.createReadStream('test.md'); var data = ''; rs.on("data",function(chunk) { data += chunk; }); rs.on("end",function() { console.log(data); });