标签:span reads read style creat utf-8 function name dirname
var fs = require("fs");
var readstream = fs.createReadStream(__dirname + "\\stuff\\readMe.txt");
var writestream = fs.createWriteStream(__dirname + "\\stuff\\writeMe.txt")
readstream.setEncoding("utf-8");
var str = "";
readstream.on("data", function (data) {
str += data;
writestream.write(data); //写入
});
readstream.on("end", function () {
console.log(str);
});
/*
var readstream = fs.createReadStream(__dirname + "\\stuff\\readMe.txt");
var writestream = fs.createWriteStream(__dirname + "\\stuff\\writeMe.txt")
readstream.pipe(writestream);
*/
标签:span reads read style creat utf-8 function name dirname
原文地址:https://www.cnblogs.com/lbx6935/p/11899727.html