Character encoding
In some cases, we need to specify the character encoding of the file we are creating or reading to ensure that data being processed is in the correct format. In the PhantomJS FileSystem API, these file character encodings are supported, but undocumented. These encodings can be defined while opening the files for reading and writing. We can do this by specifying multiple attributes in the file's mode
parameter.
var out = fs.open(filePath, {mode: 'w', charset: 'UTF-8'});
Reading and writing functions will be the same even with a defined character encoding, which is specific to the file.
The FileSystem API not only supports reading and writing of files, but also contains functions that allow you to traverse folder structures, delete, move, and rename files and folders.