nodejs-fs使用

(1)读取文本文件时须添加上'encoding'才能输出可读的内容.

02.txt

hello,world!

nodejs_readfile.js

var fs = require('fs');
fs.readFile('./02.txt', {'encoding':'utf8'},function(err,data){
	if(err) throw err;
	console.log(data);
});

(2)

原文地址:https://www.cnblogs.com/juedui0769/p/5023005.html