From baa727de93db009f90d70a80a9861758a24eae77 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 5 Nov 2019 10:27:59 +0100 Subject: docs: rename documentation folder to docs Signed-off-by: Jo-Philipp Wich --- docs/jsapi/LuCI.fs.html | 2987 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2987 insertions(+) create mode 100644 docs/jsapi/LuCI.fs.html (limited to 'docs/jsapi/LuCI.fs.html') diff --git a/docs/jsapi/LuCI.fs.html b/docs/jsapi/LuCI.fs.html new file mode 100644 index 0000000000..cfc0dc9cef --- /dev/null +++ b/docs/jsapi/LuCI.fs.html @@ -0,0 +1,2987 @@ + + + + + Class: fs + + + + + + + + + + + + + + + + + +
+ + +
+

Class: fs

+ + + + +
+ +
+

+ LuCI. + + 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 +
+ +
+ + +
+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

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

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

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 +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.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
command + + +string + + + + + + + + + + +

The command to invoke.

params + + +Array.<string> + + + + + + + optional + + + + + +

The arguments to pass to the command.

env + + +Object.<string, string> + + + + + + + optional + + + + + +

Environment variables to set.

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + +
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 +
+ +
+ + +
+
+ + +
+

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.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string + + + + + +

The file path to read.

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + Promise.<Array.<string>> + + + 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.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string + + + + + +

The directory path to list.

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + 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 +
+ +
+ + +
+
+ + +
+

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string + + + + + +

The file path to read.

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + 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 +
+ +
+ + +
+
+ + +
+

Unlink the given file.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
The + + +string + + + + + +

file path to remove.

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + 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 +
+ +
+ + +
+
+ + +
+

Return file stat information on the specified path.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string + + + + + +

The filesystem path to stat.

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + +
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 +
+ +
+ + +
+
+ + +
+

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.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string + + + + + +

The file path to read.

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

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

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

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.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
path + + +string + + + + + + + + + + +

The file path to write to.

data + + +* + + + + + + + optional + + + + + +

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

mode + + +number + + + + + + + optional + + + + + +

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

+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ + 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 + + +number + + + + + + + +

The exit code of the invoked command

stdout + + +string + + + + + + <optional>
+ + + +

The stdout produced by the command, if any

stderr + + +string + + + + + + <optional>
+ + + +

The stderr produced by the command, if any

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

LuCI.fs.FileStatEntryObject

+
+ + +
+
+ + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + +

Name of the directory entry

type + + +string + + + +

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

size + + +number + + + +

Size in bytes

mode + + +number + + + +

Access permissions

atime + + +number + + + +

Last access time in seconds since epoch

mtime + + +number + + + +

Last modification time in seconds since epoch

ctime + + +number + + + +

Last change time in seconds since epoch

inode + + +number + + + +

Inode number

uid + + +number + + + +

Numeric owner id

gid + + +number + + + +

Numeric group id

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ + + + + +
+ +
+ + + + + + + +
+ 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