Members
(constant) abbreviateUnits
- Source:
 
Units should be in desc order of values
Key should have suffix 'in' if using indian number system
(constant) baseConvert :Crypt.baseConvert
Type:
(constant) connections
- Source:
 
gracefully shuts downs a http server
Partially based on: https://github.com/sebhildebrandt/http-graceful-shutdown
LICENSE: MIT
(constant) crypt :Crypt
Type:
(constant) system :System
Type:
Methods
d(…args)
- Source:
 
Colored Log to console with stack trace
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
args | 
            
            Array.<any> | 
                
                
                
                    <repeatable> | 
            
            
            Args to log to console  | 
        
file(path) → {File}
Returns a new File object representing the file located at 'path'.
Parameters:
| Name | Type | Description | 
|---|---|---|
path | 
            
            string | path of the file  | 
        
Returns:
File object representing the file located at the path
- Type
 - File
 
getIntegerKey(key)
- Source:
 
Converts String to int key if not already number.
Returns same number if key is already number
Parameters:
| Name | Type | Description | 
|---|---|---|
key | 
            
            string | number | 
replaceSpecialChars(str, replaceWith) → {string}
- Source:
 
replace special characters within a string
NOTE: it replaces multiple special characters with single replaceWith character
Parameters:
| Name | Type | Description | 
|---|---|---|
str | 
            
            string | |
replaceWith | 
            
            string | 
Returns:
- Type
 - string
 
Type Definitions
abbreviateOpts
- Source:
 
Properties:
| Name | Type | Attributes | Description | 
|---|---|---|---|
number | 
            
            number | ||
unit | 
            
            string | 
                
                    <optional> | 
            
            
            |
decimals | 
            
            number | 
                
                    <optional> | 
            
            
            
Type:
- Object
 
addOpts
Properties:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
priority | 
            
            number | string | 
                
                    <optional> | 
            
            
                
                
                    0
                
                 | 
            
            Priority of the job, lower number is better  | 
        
attempts | 
            
            number | 
                
                    <optional> | 
            
            
                Number of attempts  | 
        |
delay | 
            
            number | 
                
                    <optional> | 
            
            
                Delay in between jobs  | 
        |
ttl | 
            
            number | 
                
                    <optional> | 
            
            
                Time to live for job  | 
        |
removeOnComplete | 
            
            boolean | 
                
                    <optional> | 
            
            
                Remove job on completion  | 
        |
noFailure | 
            
            boolean | 
                
                    <optional> | 
            
            
                Mark job as complete even if it fails  | 
        
Type:
- object
 
auth
- Source:
 
Properties:
| Name | Type | Description | 
|---|---|---|
username | 
            
            string | |
password | 
            
            string | 
Type:
- object
 
encodingConversion
- Source:
 
Properties:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
toEncoding | 
            
            string | 
                
                    <optional> | 
            
            
                
                
                    'base64url'
                
                 | 
            
            default 'base64url'  | 
        
fromEncoding | 
            
            string | 
                
                    <optional> | 
            
            
                
                
                    'binary'
                
                 | 
            
            default 'binary'  | 
        
Supported Encodings:
'hex', 'binary' ('latin1'), 'ascii', 'base64', 'base64url',
'utf8', 'buffer', 'utf16le' ('ucs2')
Type:
- object
 
encodingOpts
- Source:
 
Properties:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
encoding | 
            
            string | 
                
                    <optional> | 
            
            
                
                
                    'hex'
                
                 | 
            
            default 'hex'  | 
        
Supported Encodings:
'hex', 'binary' ('latin1'), 'ascii', 'base64', 'base64url', 'utf8', 'buffer'
Type:
- object
 
getRedisOpts
- Source:
 
Properties:
| Name | Type | Attributes | Description | 
|---|---|---|---|
parse | 
            
            function | 
                
                    <optional> | 
            
            
            fn to parse value fetched from redis  | 
        
Type:
- object
 
internalData
Properties:
| Name | Type | Description | 
|---|---|---|
input | 
            
            * | Input data given to job  | 
        
options | 
            
            object | Internal options used to set noFailure and extra properties  | 
        
Internal data object
Type:
- object
 
jobDetails
Properties:
| Name | Type | Description | 
|---|---|---|
id | 
            
            number | |
type | 
            
            string | Name of the Queue  | 
        
data | 
            
            internalData | Internal data object, includes input and options  | 
        
result | 
            
            * | Result of the processor callback  | 
        
state | 
            
            string | One of {'inactive', 'delayed' ,'active', 'complete', 'failed'}  | 
        
error | 
            
            * | |
created_at | 
            
            number | unix time stamp  | 
        
updated_at | 
            
            number | unix time stamp  | 
        
attempts | 
            
            object | Attempts Object  | 
        
Job status object.
Type:
- object
 
numberFormatOpts
- Source:
 
Properties:
| Name | Type | Description | 
|---|---|---|
locale | 
            
            string | like 'en-IN'  | 
        
currency | 
            
            string | like 'INR'  | 
        
decimals | 
            
            number | number of decimal places to return  | 
        
abbr | 
            
            number | option to abbreviate number: ['none', 'auto', 'long', 'short']  | 
        
Type:
- object
 
processObject
- Source:
 
Properties:
| Name | Type | Description | 
|---|---|---|
childProcess | 
            
            ChildProcess | |
stdout | 
            
            Buffer | |
stderr | 
            
            Buffer | 
Type:
- object
 
processorCallback(jobData) → {*}
An async function which will be called to process the job data
Parameters:
| Name | Type | Description | 
|---|---|---|
jobData | 
            
            * | The information saved in the job during adding of job  | 
        
Returns:
Will be saved in return field in JobDetails
- Type
 - *
 
queueOpts
Properties:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
enableWatchdog | 
            
            boolean | 
                
                    <optional> | 
            
            
                
                
                    false
                
                 | 
            
            Will watch for stuck jobs default: false  | 
        
logger | 
            
            Console | 
                
                    <optional> | 
            
            
                default logs to console  | 
        
Type:
- object
 
randomFunctions
- Source:
 
Properties:
| Name | Type | Description | 
|---|---|---|
seed | 
            
            number | |
index | 
            
            number | |
random | 
            
            function | number b/w 0 and 1  | 
        
int | 
            
            function | int less than num or b/w num & max  | 
        
bytes | 
            
            function | |
string | 
            
            function | |
shuffle | 
            
            function | 
Type:
- object
 
randomOpts
- Source:
 
Properties:
| Name | Type | Attributes | Description | 
|---|---|---|---|
length | 
            
            number | integer  | 
        |
base36 | 
            
            boolean | if true will use BASE_36 charset  | 
        |
charset | 
            
            string | provide a charset string  | 
        |
randomBytesFunc | 
            
            function | 
                
                    <optional> | 
            
            
            only considered for some fns  | 
        
Type:
- object
 
RedisCacheOptions
- Source:
 
Type:
- object
 
response
- Source:
 
Properties:
| Name | Type | Description | 
|---|---|---|
body | 
            
            string | the actual response body  | 
        
url | 
            
            string | the final url downloaded after following all redirects  | 
        
timeTaken | 
            
            number | time taken (in ms) for the request  | 
        
cached | 
            
            boolean | false if the response was downloaded, true if returned from a cache  | 
        
statusCode | 
            
            number | 
Type:
- object
 
setOpts
Type:
- setOptsObject | string | number
 
setOptsObject
Properties:
| Name | Type | Description | 
|---|---|---|
ttl | 
            
            number | string | in ms / timestring ('1d 3h') default: 0  | 
        
Type:
- object
 
setRedisOpts
- Source:
 
Properties:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
ttl | 
            
            number | string | in ms / timestring ('1d 3h') default: 0  | 
        ||
staleTTL | 
            
            number | string | in ms / timestring ('1d 3h')  | 
        ||
requireResult | 
            
            boolean | 
                
                    <optional> | 
            
            
                
                
                    true
                
                 | 
            
            require result to be calculated if the key does not exist  | 
        
freshResult | 
            
            boolean | 
                
                    <optional> | 
            
            
                
                
                    false
                
                 | 
            
            always return fresh value  | 
        
forceUpdate | 
            
            boolean | 
                
                    <optional> | 
            
            
                
                
                    false
                
                 | 
            
            get fresh results (ignoring ttl & staleTTL) and update cache  | 
        
parse | 
            
            function | function to parse value fetched from redis  | 
        ||
default | 
            
            any | default value to return in case if value is undefined  | 
        
Type:
- object
 
timeoutOpts
- Source:
 
Properties:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
timeout | 
            
            number | 
                
                    <optional> | 
            
            
                
                
                    10000
                
                 | 
            
            Milliseconds before timing out (default 10000)  | 
        
Type:
- object