Contains all helper and utility functions
- Source:
Methods
(inner) canWriteFileOrFolder(path)
Checks if a file or folder is writeable
- Source:
Checks if a file or folder is writeable
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Path which should be checked |
(inner) defaultDownloadFolderGet() → {String}
Validates if the default download directory of the user is useable.
- Source:
Validates if the default download directory of the user is useable.
Returns:
defaultTargetPath - The path to the folder
- Type
- String
(inner) disclaimerCheck()
Checks if the disclaimer should be shown or not
- Source:
Is using userSettingRead() to read the user setting confirmedDisclaimer.json. If it exists the user previously confirmed it.
(inner) disclaimerShow()
Opens the disclaimer as dialog
- Source:
Displays a disclaimer regarding app usage. User should confirm it once. Setting is saved in UserSettings (.json file)
(inner) downloadStatusCheck()
Checks if all downloads finished
- Source:
Checks if all downloads finished and creates a final status report using noty
Parameters:
Type | Description |
---|---|
number | overall - The amount of overall urls |
number | succeeded - The amount of succeeded urls |
number | failed - The amount of failed urls |
(inner) formatBytes(bytes, decimals)
Calculate bytes to...
- Source:
Calculate bytes to...
Parameters:
Name | Type | Description |
---|---|---|
bytes |
Incoming bytes value |
|
decimals |
(optimal, defaults to 2) |
Returns:
Human readable value
(inner) fullyDecodeURI() → {string}
Used to decode URLs
- Source:
Used to decode URLs param {string} uri - The incoming uri
Returns:
uri - a decoded url
- Type
- string
(inner) generateTimestamp() → {string}
Generates a timestamp
- Source:
Generates a timestamp using time-stamp
Returns:
- timestamp - The generates timestamp
- Type
- string
(inner) generateUrlId(url) → {string}
generates an id based on a given url
- Source:
generates an id based on a given url
Parameters:
Name | Type | Description |
---|---|---|
url |
String | url |
Returns:
urlId - the generated md5
- Type
- string
(inner) globalObjectGet(property) → {string}
Gets a value of a single property from the global object in main.js
- Source:
Gets a value of a single property from the global object in main.js
Parameters:
Name | Type | Description |
---|---|---|
property |
String | Name of the property |
Returns:
value - Value of the property
- Type
- string
(inner) globalObjectSet(property, value)
Updates the value of a single property from the global object in main.js
- Source:
Updates the value of a single property from the global object in main.js
Parameters:
Name | Type | Description |
---|---|---|
property |
String | Name of the property |
value |
String | The new value of the property |
(inner) isDirectoryAvailable(dirPath) → {boolean}
Checks if a given directory exists
- Source:
Checks if a given directory exists and returns a boolean
Parameters:
Name | Type | Description |
---|---|---|
dirPath |
string | The directory path which should be checked |
Returns:
- Type
- boolean
(inner) isDirectoryWriteable(dirPath) → {boolean}
Checks if a given directory is writeable
- Source:
Checks if a given directory is writeable and returns a boolean
Parameters:
Name | Type | Description |
---|---|---|
dirPath |
string | The directory path which should be checked |
Returns:
- Type
- boolean
(inner) isEncoded(uri) → {string}
Helper method for fullyDecodeURI
- Source:
Helper method for fullyDecodeURI
Parameters:
Name | Type | Description |
---|---|---|
uri |
string | the uri to check |
Returns:
uri - the decoded uri
- Type
- string
(inner) openURL(url)
Opens an url in browser
- Source:
Opens a given url in default browser. This is pretty slow, but got no better solution so far.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | URL string which contains the target url |
(inner) pathExists() → {boolean}
Checks if a given filepath exists
- Source:
Checks if a given filepath exists using fs. Returns a boolean param {string} path - The path which should be checked for existance
Returns:
-If path exists or not
- Type
- boolean
(inner) showNotification(message, titleopt)
Shows a desktop notification
- Source:
Shows a desktop notification
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The notification message text |
|
title |
string |
<optional> |
The title of the desktop notification |
(inner) showNoty(type, message, timeoutopt)
Shows a noty notification
- Source:
Creates an in-app notification using the noty framework
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | Options: alert, success, warning, error, info/information |
|
message |
string | notification text |
|
timeout |
number |
<optional> |
Timevalue, defines how long the message should be displayed. Use 0 for no-timeout |
(inner) userSettingRead(key, optionalUpdateSettingUIopt)
Read a user setting from file
- Source:
Reads a value stored in local storage (for a given key)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
String | Name of local storage key |
|
optionalUpdateSettingUI |
Boolean |
<optional> |
Boolean used for an ugly hack |
(inner) userSettingWrite(key, value, silentopt)
Write a user setting to file
- Source:
Writes a value for a given key to electron-json-storage
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
String | Name of storage key |
|
value |
String | New value |
|
silent |
boolean |
<optional> |
If true - no notification is displayed on initial settingscreation |
Throws:
Exception when writing a file failed
(inner) validURL(-str) → {boolean}
checks if a given string is a valid url
- Source:
checks if a given string is a valid url
Parameters:
Name | Type | Description |
---|---|---|
-str |
string | Given url |
Returns:
- Type
- boolean
(inner) writeConsoleMsg(type, message, optionalObject)
Writes console output for the renderer process
- Source:
Writes console output for the renderer process
Parameters:
Name | Type | Description |
---|---|---|
type |
string | String which defines the log type |
message |
string | String which defines the log message |
optionalObject |
string | An optional object which might contain additional informations |