您的位置:首页 > Web前端 > Node.js

nodejs read/write file

2014-12-05 15:43 197 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: