In this post I’m going to show you how we can read and write files on our local filesystem using Node.js.
Being able to read files from you local filesystem can be very useful and there’s a buntch of stuff you can do with it, for example read local Json files and load Spreadsheets to your program.
To start, just create a js file and name it whatever you want. Then open this file in your editor of choice.
Reading from files is done via the core fs module. The fs module provides an API for interacting with the file system in a manner closely modeled around standard POSIX functions.