Learning Node.js Development
上QQ阅读APP看书,第一时间看更新

Storing the string in a file

With the basics in place, let's take it just one step further, that is, by storing the string in a file. Then, we want to read the contents of that file back by using the fs module and printing some properties from it. This means that we'll need to convert the string that we get back from fs.readfilesync into an object using JSON.parse.