new FileSystem(root_directoryopt, optionsopt)
constructor
synopsis:
new FileSystem();
new FileSystem('/path/to/directory');
new FileSystem({ encoding : 'utf8' });
new FileSystem('/path/to/directory', { encoding : 'utf8' });
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
root_directory |
string |
<optional> |
the root directory on the host file system |
options |
FileSystemOptions |
<optional> |
options |
- Source:
Methods
access(host_file_path, options) → {Promise}
Access
Parameters:
Name | Type | Description |
---|---|---|
host_file_path |
string | a file path on the host (either relative to root directory or absolute) |
options |
Object | access options |
- Source:
Returns:
a promise
- Type
- Promise
check_abs_directory_path(abs_host_dir_path) → {boolean}
Check that absolute directory path is not referencing something outside of root directory
Parameters:
Name | Type | Description |
---|---|---|
abs_host_dir_path |
string | an absolute directory path on the host |
- Source:
Returns:
- Type
- boolean
check_abs_file_path(abs_host_file_path) → {boolean}
Check that absolute file path is not referencing something outside of root directory
Parameters:
Name | Type | Description |
---|---|---|
abs_host_file_path |
string | an absolute file path on the host |
- Source:
Returns:
- Type
- boolean
find(starting_point, optionsopt) → {Promise.Array.<string>}
Find according to a path regular expression
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
starting_point |
string | starting point (directory name) | |
options |
FindOptions |
<optional> |
find options |
- Source:
Returns:
a promise
- Type
- Promise.Array.<string>
fix_path(abs_path) → {string}
Make absolute path relative to root directory
Parameters:
Name | Type | Description |
---|---|---|
abs_path |
string | absolute - path to fix |
- Source:
Returns:
a fixed path
- Type
- string
get_abs_path(rel_path) → {string}
Get the absolute path (on the host file system) from a file relative path
Parameters:
Name | Type | Description |
---|---|---|
rel_path |
string | a file relative path |
- Source:
Returns:
the absolute path of the file on the host file system
- Type
- string
make_abs_path(_path) → {string}
Make an absolute path
Parameters:
Name | Type | Description |
---|---|---|
_path |
string | a path either relative to root directory or absolute |
- Source:
Returns:
an absolute path
- Type
- string
make_rel_path(_path) → {string}
Make a relative path
Parameters:
Name | Type | Description |
---|---|---|
_path |
string | an absolute path |
- Source:
Returns:
a path relative to root directory
- Type
- string
make_root_directory() → {Promise}
Make root directory
- Source:
Returns:
a promise
- Type
- Promise
make_temporary_root_directory() → {Promise}
Make temporary root directory
- Source:
Returns:
a promise
- Type
- Promise
mkdir_p(host_dir_path) → {Promise}
Make directory recursively
Parameters:
Name | Type | Description |
---|---|---|
host_dir_path |
string | a directory path on the host (either relative to root directory or absolute) |
- Source:
Returns:
a promise
- Type
- Promise
readFile(host_file_path, options) → {Promise.<File>}
read file
Parameters:
Name | Type | Description |
---|---|---|
host_file_path |
string | a file path on the host (either relative to root directory or absolute) |
options |
ReadFileOptions | reading file options |
- Source:
Returns:
a promise
- Type
- Promise.<File>
remove_root_directory() → {Promise}
Remove root directory
- Source:
Returns:
a promise
- Type
- Promise
remove_temporary_root_directory() → {Promise}
Remove temporary root directory
- Source:
Returns:
a promise
- Type
- Promise
rmdir_r(host_dir_path) → {Promise}
Remove directory recursively
Parameters:
Name | Type | Description |
---|---|---|
host_dir_path |
string | a directory path on the host (either relative to root directory or absolute) |
- Source:
Returns:
a promise
- Type
- Promise
stat(host_file_path, options) → {Promise}
Stat
Parameters:
Name | Type | Description |
---|---|---|
host_file_path |
string | a file path on the host (either relative to root directory or absolute) |
options |
Object | stat options |
- Source:
Returns:
a promise
- Type
- Promise
unlink(host_file_path) → {Promise}
Unlink
Parameters:
Name | Type | Description |
---|---|---|
host_file_path |
string | a file path on the host (either relative to root directory or absolute) |
- Source:
Returns:
a promise
- Type
- Promise
writeFile(file, optionsopt) → {Promise}
write file
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
file |
File | a file | |
options |
WriteFileOptions |
<optional> |
writing file options |
- Source:
Returns:
a promise
- Type
- Promise