Namespace: file

qz.file

Calls related to interactions with the filesystem
Since:
  • 2.1
Source:

Methods

(static) list(path, paramsopt) → {Promise.<(Array.<String>|Error)>}

List of files available at the given directory.
Due to security reasons, paths are limited to the qz data directory unless overridden via properties file.
Parameters:
Name Type Attributes Description
path string Relative or absolute directory path. Must reside in qz data directory or a white-listed location.
params Object <optional>
Object containing file access parameters
Properties
Name Type Attributes Default Description
sandbox boolean <optional>
true If relative location from root is only available to the certificate's connection, otherwise all connections
shared boolean <optional>
true If relative location from root is accessible to all users on the system, otherwise just the current user
Source:
Returns:
Array of files at the given path
Type
Promise.<(Array.<String>|Error)>

(static) read(path, paramsopt) → {Promise.<(String|Error)>}

Reads contents of file at the given path.
Due to security reasons, paths are limited to the qz data directory unless overridden via properties file.
Parameters:
Name Type Attributes Description
path string Relative or absolute file path. Must reside in qz data directory or a white-listed location.
params Object <optional>
Object containing file access parameters
Properties
Name Type Attributes Default Description
sandbox boolean <optional>
true If relative location from root is only available to the certificate's connection, otherwise all connections
shared boolean <optional>
true If relative location from root is accessible to all users on the system, otherwise just the current user
Source:
Returns:
String containing the file contents
Type
Promise.<(String|Error)>

(static) remove(path, paramsopt) → {Promise.<(null|Error)>}

Deletes a file at given path.
Due to security reasons, paths are limited to the qz data directory unless overridden via properties file.
Parameters:
Name Type Attributes Description
path string Relative or absolute file path. Must reside in qz data directory or a white-listed location.
params Object <optional>
Object containing file access parameters
Properties
Name Type Attributes Default Description
sandbox boolean <optional>
true If relative location from root is only available to the certificate's connection, otherwise all connections
shared boolean <optional>
true If relative location from root is accessible to all users on the system, otherwise just the current user
Source:
Returns:
Type
Promise.<(null|Error)>

(static) setFileCallbacks(calls)

List of functions called for any response from a file listener. For ERROR types event data will contain, {string} message. For ACTION types event data will contain, {string} file {string} eventType {string} [data].
Parameters:
Name Type Description
calls function | Array.<function()> Single or array of Function({Object} eventData) calls.
Since:
  • 2.1.0
Source:

(static) startListening(path, paramsopt) → {Promise.<(null|Error)>}

Provides a continuous stream of events (and optionally data) from a local file.
Parameters:
Name Type Attributes Description
path string Relative or absolute directory path. Must reside in qz data directory or a white-listed location.
params Object <optional>
Object containing file access parameters
Properties
Name Type Attributes Default Description
sandbox boolean <optional>
true If relative location from root is only available to the certificate's connection, otherwise all connections
shared boolean <optional>
true If relative location from root is accessible to all users on the system, otherwise just the current user
listener Object <optional>
If defined, file data will be returned on events
Properties
Name Type Attributes Default Description
bytes number <optional>
-1 Number of bytes to return or -1 for all
lines number <optional>
-1 Number of lines to return or -1 for all
reverse boolean <optional>
Controls whether data should be returned from the bottom of the file. Default value is true for line mode and false for byte mode.
Since:
  • 2.1.0
Source:
See:
Returns:
Type
Promise.<(null|Error)>

(static) stopListening(pathopt, paramsopt) → {Promise.<(null|Error)>}

Closes listeners with the provided settings. Omitting the path parameter will result in all listeners closing.
Parameters:
Name Type Attributes Description
path string <optional>
Previously opened directory path of listener to close, or omit to close all.
params Object <optional>
Object containing file access parameters
Properties
Name Type Attributes Default Description
sandbox boolean <optional>
true If relative location from root is only available to the certificate's connection, otherwise all connections
shared boolean <optional>
true If relative location from root is accessible to all users on the system, otherwise just the current user
Source:
Returns:
Type
Promise.<(null|Error)>

(static) write(path, params) → {Promise.<(null|Error)>}

Writes data to the file at the given path.
Due to security reasons, paths are limited to the qz data directory unless overridden via properties file.
Parameters:
Name Type Description
path string Relative or absolute file path. Must reside in qz data directory or a white-listed location.
params Object Object containing file access parameters
Properties
Name Type Attributes Default Description
data string File data to be written
sandbox boolean <optional>
true If relative location from root is only available to the certificate's connection, otherwise all connections
shared boolean <optional>
true If relative location from root is accessible to all users on the system, otherwise just the current user
append boolean <optional>
false Appends to the end of the file if set, otherwise overwrites existing contents
Source:
Returns:
Type
Promise.<(null|Error)>