From 355a48866d1a43df9443a3b559c8ec8642343f3a Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 5 Nov 2019 10:18:51 +0100 Subject: documentation: change JS docs template Use another template for the JS api documentation which provides a better overview over the classes and methods. Signed-off-by: Jo-Philipp Wich --- documentation/jsapi/LuCI.fs.html | 3344 ++++++++++++++++++++++++-------------- 1 file changed, 2094 insertions(+), 1250 deletions(-) (limited to 'documentation/jsapi/LuCI.fs.html') diff --git a/documentation/jsapi/LuCI.fs.html b/documentation/jsapi/LuCI.fs.html index abae649cbe..cfc0dc9cef 100644 --- a/documentation/jsapi/LuCI.fs.html +++ b/documentation/jsapi/LuCI.fs.html @@ -1,156 +1,1200 @@ - + - JSDoc: Class: fs - - - + Class: fs + + + + + - - + + + + + + + + - -
- -

Class: fs

- +
+ +
+

Class: fs

+
- +
+

+ LuCI. -

- LuCI.fs

- -

Provides high level utilities to wrap file system related RPC calls. + fs + + +

Provides high level utilities to wrap file system related RPC calls. To import the class in views, use 'require fs', to import it in external JavaScript, use L.require("fs").then(...).

- - -
- -
-
- - - - - - - - - - - - - - - - - -
- + +
+
- - - + +
+
+

+ + new LuCI.fs() +

+ +
+ fs.js, line 111 +
+ +
- +
+
- - - - - -
Source:
-
- - +
+ + + + + + + + + + + + + + + + + +
+ + + - - - - - - - - - - - - - - - - + + + + + + + +
- - - - - - - - + + + + + +

Methods

- +
- +
+
+

+ + exec(command, params, env){Promise.<LuCI.fs.FileExecResult>} +

+ +
+ fs.js, line 232 +
+ +
-

exec(command, paramsopt, envopt) → {Promise.<LuCI.fs.FileExecResult>}

+
+
- - - - -
-

Execute the specified command, optionally passing params and +

+

Execute the specified command, optionally passing params and environment variables.

Note: The command must be either the path to an executable, or a basename without arguments in which case it will be searched @@ -158,46 +1202,39 @@ in $PATH. If specified, the values given in params will be passed as arguments to the command.

The key/value pairs in the optional env table are translated to setenv() calls prior to running the command.

-
- - - - - - - - +
+ -
Parameters:
+ + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - - + - - - + + + - + - - - - - + - - - + + + - + - - - - - + - - - + + +
NameTypeAttributesDescription
NameTypeDescription
command @@ -206,29 +1243,26 @@ as arguments to the command.

- - - - - -

The command to invoke.

+ + + + + + +

The command to invoke.

params @@ -237,31 +1271,28 @@ as arguments to the command.

- - <optional>
- - - - - -

The arguments to pass to the command.

+ + + optional + + + + + +

The arguments to pass to the command.

env @@ -270,172 +1301,155 @@ as arguments to the command.

- - <optional>
- - - - - -

Environment variables to set.

+ + + optional + + + + + +

Environment variables to set.

- - - - - - + + +
- - + - - - - - - - - - - -
Source:
-
- - - + +
+ + + + + + + + +
Returns:
+ - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to an object describing the execution -results or rejecting with an error stating the failure reason.

-
- - - -
-
- Type -
-
+ + + -Promise.<LuCI.fs.FileExecResult> - - - - - + + + + + + + + + + + + +
TypeDescription
+ + Promise.<LuCI.fs.FileExecResult> + + + Returns a promise resolving to an object describing the execution +results or rejecting with an error stating the failure reason.
- - - + + + +
- +
+
+

+ + lines(path){Promise.<Array.<string>>} +

+ +
+ fs.js, line 281 +
+ +
-

lines(path) → {Promise.<Array.<string>>}

+
+
- - - - -
-

Read the contents of the given file, split it into lines, trim +

+

Read the contents of the given file, split it into lines, trim leading and trailing white space of each line and return the resulting array.

This function is guaranteed to not reject its promises, on failure, an empty array will be returned.

-
- - - - - - - - +
+ -
Parameters:
+ + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - + + - - - + + +
NameTypeDescription
NameTypeDescription
path @@ -444,319 +1458,291 @@ an empty array will be returned.

The file path to read.

+ +

The file path to read.

- - - - - - + + +
- - + - - - - - - - - - - -
Source:
-
- - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to an array containing the stripped lines -of the given file or [] on failure.

-
- - - -
-
- Type -
-
- -Promise.<Array.<string>> - - -
+ +
- - - - - - - + -

list(path) → {Promise.<Array.<LuCI.fs.FileStatEntry>>}

- - - - -
-

Obtains a listing of the specified directory.

-
- - - - - - - - - -
Parameters:
+ +
Returns:
+ + - - - - - - - - - - - - - - - - - - - + -
NameTypeDescription
path - -string - - - + Promise.<Array.<string>> + +

The directory path to list.

Returns a promise resolving to an array containing the stripped lines +of the given file or [] on failure.
- - - - - -
- - - - - - - - - - - +
+ + +
+
+

+ + list(path){Promise.<Array.<LuCI.fs.FileStatEntry>>} +

+ +
+ fs.js, line 132 +
+ +
- +
+
- - +
+

Obtains a listing of the specified directory.

+
-
Source:
-
- - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to an array of stat detail objects or -rejecting with an error stating the failure reason.

-
- - - -
-
- Type -
-
-Promise.<Array.<LuCI.fs.FileStatEntry>> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string - - + + + +

The directory path to list.

+ + + +
- - - - - - - - -

read(path) → {Promise.<string>}

+ + + + + + + + + + + + + + +
+ + + -
-

Read the contents of the given file and return them. -Note: this function is unsuitable for obtaining binary data.

-
- - - - - - - - - -
Parameters:
+ + + + +
Returns:
+ + - - - + + + + + + + + + + + + +
NameTypeDescription
+ + Promise.<Array.<LuCI.fs.FileStatEntry>> + + + Returns a promise resolving to an array of stat detail objects or +rejecting with an error stating the failure reason.
- + + + +
+ +
+
+

+ + read(path){Promise.<string>} +

+ + +
+ fs.js, line 161 +
+ +
- Description - - + +
+
+ + +
+

Read the contents of the given file and return them. +Note: this function is unsuitable for obtaining binary data.

+
+ - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + - - - + + +
NameTypeDescription
path @@ -765,158 +1751,144 @@ Note: this function is unsuitable for obtaining binary data.

The file path to read.

+ +

The file path to read.

- - - - - - + + +
- - + - - - - - - - - - - -
Source:
-
- - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to a string containing the file contents or -rejecting with an error stating the failure reason.

-
- - - -
-
- Type -
-
- -Promise.<string> - - -
+ +
- - - - - - - + -

remove(The) → {Promise.<number>}

- - - - -
-

Unlink the given file.

-
- - - - - - - - - -
Parameters:
+ +
Returns:
+ + - - - + + + + + + + + + + + + +
NameTypeDescription
+ + Promise.<string> + + + Returns a promise resolving to a string containing the file contents or +rejecting with an error stating the failure reason.
- + + + +
+ +
+
+

+ + remove(The){Promise.<number>} +

+ + +
+ fs.js, line 203 +
+ +
- Description - - + +
+
+ + +
+

Unlink the given file.

+
+ - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + - - - + + +
NameTypeDescription
The @@ -925,158 +1897,144 @@ rejecting with an error stating the failure reason.

file path to remove.

+ +

file path to remove.

- - - - - - -
- - - - - - +
- + - - - - - - -
Source:
-
- - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to 0 or rejecting with an error stating -the failure reason.

-
- - - -
-
- Type -
-
- -Promise.<number> - - -
-
- - - - - - - - - - -

stat(path) → {Promise.<LuCI.fs.FileStatEntry>}

- + +
+ + + -
-

Return file stat information on the specified path.

-
- - - - - - - - - -
Parameters:
+ + + + + +
Returns:
+ - - - + + + + + + + + + + + + +
NameTypeDescription
+ + Promise.<number> + + + Returns a promise resolving to 0 or rejecting with an error stating +the failure reason.
- + + + +
+ +
+
+

+ + stat(path){Promise.<LuCI.fs.FileStatEntry>} +

+ + +
+ fs.js, line 146 +
+ +
- Description - - + +
+
+ + +
+

Return file stat information on the specified path.

+
+ - + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + - - - + + +
NameTypeDescription
path @@ -1085,164 +2043,150 @@ the failure reason.

The filesystem path to stat.

+ +

The filesystem path to stat.

- - - - - - + + +
- - + - - - - - - - - - - -
Source:
-
- - - + +
+ + + + + + + + +
Returns:
+ - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to a stat detail object or -rejecting with an error stating the failure reason.

-
- - - -
-
- Type -
-
+ + + -Promise.<LuCI.fs.FileStatEntry> - - - - - + + + + + + + + + + + + +
TypeDescription
+ + Promise.<LuCI.fs.FileStatEntry> + + + Returns a promise resolving to a stat detail object or +rejecting with an error stating the failure reason.
- - - + + + +
- +
+
+

+ + trimmed(path){Promise.<string>} +

+ +
+ fs.js, line 260 +
+ +
-

trimmed(path) → {Promise.<string>}

+
+
- - - - -
-

Read the contents of the given file, trim leading and trailing white +

+

Read the contents of the given file, trim leading and trailing white space and return the trimmed result. In case of errors, return an empty string instead.

Note: this function is useful to read single-value files in /sys or /proc.

This function is guaranteed to not reject its promises, on failure, an empty string will be returned.

-
- - - - - - - - +
+ -
Parameters:
+ + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - + + - - - + + +
NameTypeDescription
NameTypeDescription
path @@ -1251,164 +2195,148 @@ an empty string will be returned.

The file path to read.

+ +

The file path to read.

- - - - - - + + +
- - + - - - - - - - - - - -
Source:
-
- - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to the file contents or the empty string -on failure.

-
- - - -
-
- Type -
-
- -Promise.<string> - - -
+ +
+ + + + + + + +
Returns:
+ - + + + + + + + + + + - + + + + +
TypeDescription
+ + Promise.<string> + + + Returns a promise resolving to the file contents or the empty string +on failure.
-

write(path, dataopt, modeopt) → {Promise.<number>}

- +
+ + +
+
+

+ + write(path, data, mode){Promise.<number>} +

+ + +
+ fs.js, line 187 +
+ +
- -
-

Write the given data to the specified file path. + +

+
+ + +
+

Write the given data to the specified file path. If the specified file path does not exist, it will be created, given sufficient permissions.

Note: data will be converted to a string using String(data) or to '' when it is null.

-
- - - - - - - - +
+ -
Parameters:
+ + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - - + - - - + + + - + - - - - - - - - + + + - + - - - - - + - - - + + +
NameTypeAttributesDescription
NameTypeDescription
path @@ -1417,29 +2345,26 @@ sufficient permissions.

- - - - - -

The file path to write to.

+ + + + + + +

The file path to write to.

data @@ -1448,32 +2373,29 @@ sufficient permissions.

- - <optional>
- - - - - -

The file data to write. If it is null, it will be set to an empty +

+ + + optional + + + + + +

The file data to write. If it is null, it will be set to an empty string.

mode @@ -1482,175 +2404,148 @@ string.

- - <optional>
- - - - - -

The permissions to use on file creation. Default is 420 (0644).

+ + + optional + + + + + +

The permissions to use on file creation. Default is 420 (0644).

- - - - - - + + +
- - + - - - - - - - - - - -
Source:
-
- - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
-

Returns a promise resolving to 0 or rejecting with an error stating -the failure reason.

-
- - - -
-
- Type -
-
- -Promise.<number> - - -
+ +
- - - - - - -

Type Definitions

- - - -

FileExecResult

- - - - - - -
Type:
-
    -
  • - -Object - - -
  • -
- - - - - -
Properties:
+ + + + +
Returns:
+ - + +
- - - - - - - - - - - + + + + + + + +
NameTypeAttributesDescription
+ + Promise.<number> + + + Returns a promise resolving to 0 or rejecting with an error stating +the failure reason.
+ + + + + + + + + + +

Type Definitions

+ +
+ +
+
+

LuCI.fs.FileExecResultObject

+
+ + +
+
+ + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - - - + + + - + - + - - + + - - - + + + - + - + - - + + - + + + +
NameTypeArgumentDescription
code @@ -1659,27 +2554,27 @@ the failure reason.

- +

The exit code of the invoked command

stdout @@ -1688,29 +2583,29 @@ the failure reason.

<optional>
- +

The stdout produced by the command, if any

stderr @@ -1719,126 +2614,98 @@ the failure reason.

<optional>
- +

The stderr produced by the command, if any

+ - - - - - - -
- + - - - - - - - - - - - -
Source:
-
- - - +
- - - - + + +
-

FileStatEntry

- - - - - - -
Type:
-
    -
  • - -Object - - -
  • -
- - - - - -
Properties:
- +
+
+

LuCI.fs.FileStatEntryObject

+
+ + +
+
+ + + +
- - - - - - - - - - - +
Properties:
+
-
- - - - - - +
NameTypeDescription
+ + + + + + + + + + + + + + + + + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - - - + + + - + - - - + + + - + + + +
NameTypeDescription
name @@ -1847,21 +2714,21 @@ the failure reason.

Name of the directory entry

type @@ -1870,21 +2737,21 @@ the failure reason.

Type of the entry, one of block, char, directory, fifo, symlink, file, socket or unknown

size @@ -1893,21 +2760,21 @@ the failure reason.

Size in bytes

mode @@ -1916,21 +2783,21 @@ the failure reason.

Access permissions

atime @@ -1939,21 +2806,21 @@ the failure reason.

Last access time in seconds since epoch

mtime @@ -1962,21 +2829,21 @@ the failure reason.

Last modification time in seconds since epoch

ctime @@ -1985,21 +2852,21 @@ the failure reason.

Last change time in seconds since epoch

inode @@ -2008,21 +2875,21 @@ the failure reason.

Inode number

uid @@ -2031,21 +2898,21 @@ the failure reason.

Numeric owner id

gid @@ -2054,90 +2921,67 @@ the failure reason.

Numeric group id

+ - - - - - - -
- + - - - - - - - - - - - -
Source:
-
- - - +
+ + +
- - - - - +
+ +
-
- - + -
- -
-
- Documentation generated by JSDoc 3.6.3 on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time) -
+ - - +
+ Documentation generated by JSDoc 3.6.3 on Tue Nov 05 2019 10:17:12 GMT+0100 (Central European Standard Time) +
+
+
+ + \ No newline at end of file -- cgit v1.2.3