09: Files

I am going to show you the simplest way to read something from a file, but this is definitely not the only way nor is it the best way. JavaScript is rather obsessed with many ways to read data, but before you can understand them you need to learn about functions. Functions come later in the book, so for now I'll show you how to just pull in all of a file in one move and then play with it.

The Code

You can read the documentation for the file Application Programmer Interface (API) at https://nodejs.org/api/fs.html, but don't get discouraged if this makes zero sense. Just glance through it and know it exists.

{{ ork.js() }}

Learn JavaScript Today

Register today for the Beginner Basics course and get the new releases by just paying the difference. There's also special discounts for existing customers when new courses are released.


Still Not Sure? Check out more curriculum!