首页 > Web开发 > 详细

nodejs read/write file

时间:2014-12-05 16:49:13      阅读:398      评论:0      收藏:0      [点我收藏+]

 

 

fs.readFile(‘c:\\tmp\\helloworld.txt‘,‘utf8‘,function(err,data){console.log(data);})

  

 var token=fs.readFileSync(‘c:\\tmp\\toekn.txt‘,‘utf8‘);

  

 

fs.writeFile(‘c:\\tmp\\helloworld.txt‘, ‘Hello World! now, hello again!‘)

  

fs.exists(‘c:\\tmp\\helloworld.txt‘,function(exists){console.log(exists);})

  

fs.existsSync(‘c:\\tmp\\helloworld.txt‘)

  

http://nodejs.org/api/fs.html#fs_fs_exists_path_callback

https://docs.nodejitsu.com/articles/file-system/how-to-read-files-in-nodejs

 

nodejs read/write file

原文:http://www.cnblogs.com/zyip/p/4146823.html

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