• Download
  • Demo
  • Buy
  • API
  • Docs
  • Support
  • About
  • Contact
  • Login
API Home
Namespaces
qzapiconfigsfilehidnetworkingprinterssecurityserialsocketusbwebsocket
API Home
Namespaces
qzapiconfigsfilehidnetworkingprinterssecurityserialsocketusbwebsocket

Namespace: file

qz.file

Calls related to interactions with the filesystem
Since:
  • 2.1
Source:
  • qz-tray.js, line 2312

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:
  • qz-tray.js, line 2330
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
flavor string <optional>
'plain' Flavor of data format used, valid flavors are [base64 | hex | plain].
Source:
  • qz-tray.js, line 2348
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:
  • qz-tray.js, line 2385
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:
  • qz-tray.js, line 2448

(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.
include string | Array.<string> <optional>
File patterns to match. Blank values will be ignored.
exclude string | Array.<string> <optional>
File patterns to exclude. Blank values will be ignored. Takes priority over params.include.
ignoreCase boolean <optional>
true Whether params.include or params.exclude are case-sensitive.
Since:
  • 2.1.0
Source:
  • qz-tray.js, line 2411
See:
  • qz.file.setFileCallbacks
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:
  • qz-tray.js, line 2433
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
flavor string <optional>
'plain' Flavor of data format used, valid flavors are [base64 | file | hex | plain].
Source:
  • qz-tray.js, line 2368
Returns:
Type
Promise.<(null|Error)>
Documentation generated by JSDoc 3.6.11

© 2023 qz | Privacy Policy