Introduction
PhantomJS exposes several core APIs to work with the headless browser and with the operating system that hosts the runtime. For example, we can get information about PhantomJS, inspect our host environment for values assigned to variables, and read from or write to the filesystem with the help of these APIs.
The recipes in this chapter will focus on those APIs that are considered part of the PhantomJS core. Specifically, we will introduce and discuss the global phantom
object, the system
and fs
modules, and how to create and load our own CommonJS-compatible modules.