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() }}

80% Discount for Alpha 1

Register today for the early access release and get an 80% discount on the final release price. You'll get true lessons in true modules right now, and early access to content as it's released.

Still Not Sure? Check out more curriculum!