首页 > Web开发 > 详细

nodejs-fs使用

时间:2015-12-06 09:57:05      阅读:112      评论:0      收藏:0      [点我收藏+]

(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)

 

nodejs-fs使用

原文:http://www.cnblogs.com/juedui0769/p/5023005.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!