Autoloads a file into the Node REPL on start then passes control to the user.

Autoloads a file into the Node REPL on start then passes control to the user.

npm install atropa-repl-autoload

Takes three args, a file and encoding, exactly like fs.readFileSync. So yes, the encoding is optional and defaults to utf8. The third argument is an optional options object which corresponds to the options for repl.start

On the command line the third option will require quoting and escaping per your shell's instructions and then you'll need to JSON.parse it before passing it off. It may be easier to simply specify the options arg in your js file or leaving the argument unspecified and accepting the defaults.

This would be useful for code editors that allow you to launch external programs and pass the filename of the currently focused file. You would be able to load the file you're editing into the REPL and try things out right away.

In notepad++ the command would look something like node path\to\thisScript.js "\$(FULL_CURRENT_PATH)" if you were to name the following example thisScript.js and have node in your path.

This would also be useful if you wanted to load the same file into the repl all the time. Say, for instance, if you were working on a library.

Visual studio intellisense support is available in docs/vsdoc/OpenLayersAll.js Full documentation may be found at http://matthewkastor.github.com/atropa-replAutoload