How To Write A Script Using A File . Let us look at the exmaples of reading and writing files using the fs module on node.js let us create a js file named main.js having the following code − Open windows powershell ise as an. Creating and running a script from tldp.org For example, you might want to name it hello_world.bat. Open a new notepad file. To read a file, we need a file in the first place.