Brad Lucas

A blog mostly about programming
July 25, 2017

Loading File Into Node Repl

So the day after writing a post about working in multiple languages I find myself in front of Node writing in JavaScript. Nothing big to start.

I was writing things in a file and then executing them with node file.js when I decided it was time to work inside the Node repl.

For this the question became how do you load your file and have access to the functions and variables.

The answer:

$ node
> .load file.js
.
. ... messages
.
>

Nicely, after editing the file you can reload it by executing the same again.


Tags: javascript