Documentation not complete. Please help us to fill this page :-)
This module implements the file system API specified in CommonJS.
This module is mostly copied from the Mozilla Add-on SDK’s io/file module. its documentation may be useful.
It changes the working directory. But only in the SlimerJS “process”. When SlimerJS is terminated, the real working directory is the same when SlimerJS started.
This property contains the current working directory. It cannot be set. Use changeWorkingDirectory.
Note: in CommonJS, it is defined as a method, but in phantomjs, it is a property. So this is a property to be compatible with phantomjs.
true if the file or directory exists. Otherwise it returns false.
true if this object corresponds to a normal file. Otherwise it returns false.
true if this object corresponds to a directory. Otherwise it returns false.
This method tests whether or not this object corresponds to a file or directory that may be read by the user.
true if the file or directory may be modified by the user. Otherwise it returns false.
This method tests whether or not this object corresponds to a symbolic link, shortcut, or alias.
returns the number of bytes corresponding to the data represented by the file.
returns a Date object of the last modified time of the file.
Shorthand for open(path,mode).read(). Stream is closed after reading.
Shorthand for open(path,mode).write(content). Stream is closed after writing.
A valid path component separator. May be hard-coded to ‘/’.
Takes a variable number of strings, joins them on the file system’s path separator, and returns the result.
Returns an array of path components from a path.
Returns path with the last path component removed.
Not implemented in PhantomJS <=2.1 at least.
Deprecated, use directory() instead. Not implemented in PhantomJS
Returns the final component of a path. Not implemented in PhantomJS <=2.1 at least.
Deprecated, use base() instead. Not implemented in PhantomJS.
Returns the absolute path of a given path, resolving any components ”.” or ”..” and replacing multiple separators with single separators. Does not resolve Unix symbolic links.
It returns a dot following by the part of the path after the last dot.
The method accept a non standard second parameters, a boolean indicating if you want the extension without the dot character (true) or not.
fs.extension("file.txt"); // returns ".txt"
fs.extension("file.txt", true); // returns "txt"
Not implemented in PhantomJS <=2.1 at least.
Returns an array of file names in the given directory.
Returns a stream providing access to the contents of a file.
opts is optional. It can be a single string, indicating the open mode, or an object containing these properties:
mode: the open mode
charset: the charset code (IANA code). Charset is ignored if the mode is binary mode
the write method of the stream (SlimerJS only).
Mode is a string that can contain character which describes a characteristic of the returned stream.
If the string contains “r”, the file is opened in read-only mode.
“w” opens the file in write-only mode.
opened in text mode, and its contents are assumed to be UTF-8.
“a” means to open as “append” mode: the file is open in write-only mode and all written character are append to the file
Removes a file from the file system. To remove directories, use rmdir.
Create a single directory specified by path. If the directory cannot be created for any reason an exception will be thrown. This includes if the parent directories of “path” are not present.
Documentation needed
Deprecated. Use makeDirectory(path). Not implemented in PhantomJS.
Removes a directory from the file system. If the directory is not empty, an exception is thrown.
Removes a directory and its contents recursively.
Documentation needed
Documentation needed
Documentation needed
Documentation needed
Documentation needed