Class node-utils
Class defined in:src/node-utils.js:11
Provides utility functions for the SAGE2 server
checkPackages( inDevelopement )
src/node-utils.js:394
Compare the installed pacakges versus the specified ones in packages.json warms the user of outdated packages
Parameters:-
inDevelopement<Bool>whether or not to check in production mode (no devel packages)
compareFilename( a, b )
src/node-utils.js:327
Utility function, used while sorting, to compare two objects based on filename independently of case. Needs a .exif.FileName field
Parameters:compareString( a, b )
src/node-utils.js:307
Utility function to compare two strings independently of case. Used for sorting
Parameters:compareTitle( a, b )
src/node-utils.js:347
Utility function to compare two objects based on title independently of case. Needs a .exif.metadata.title field Used for sorting
Parameters:deleteFiles( pattern, cb )
src/node-utils.js:644
Delete files, with glob, and a callback when done
Parameters:encodeReservedPath( aUrl )
src/node-utils.js:505
Return a safe URL string: make Windows path to URL
Parameters:-
aUrl<String>URL to be sanitized
cleanup version of the URL
encodeReservedURL( aUrl )
src/node-utils.js:492
Return a safe URL string: convert odd characters to HTML representations
Parameters:-
aUrl<String>URL to be sanitized
cleanup version of the URL
fileExists( filename )
src/node-utils.js:69
Test if file is exists
Parameters:-
filename<String>name of the file to be tested
true if exists
folderExists( directory )
src/node-utils.js:89
Test if folder is exists
Parameters:-
directory<String>name of the folder to be tested
true if exists
getFullVersion( callback )
src/node-utils.js:187
Full version is processed from git information
Parameters:-
callback<Function>function to be run when finished, parameter is an object containing base, branch, commit and date fields
getHomeDirectory( )
src/node-utils.js:517
Return a home directory on every platform
string representing a folder path
getShortVersion( )
src/node-utils.js:161
Base version comes from evaluating the package.json file
version number as x.x.x
header( h )
src/node-utils.js:273
Utility function to create a header for console messages
Parameters:-
h<String>header text
header formatted text
isTrue( value )
src/node-utils.js:368
Utility function to test if a string or number represents a true value. Used for parsing JSON values
Parameters:-
value<Object>value to test
loadCABundle( filename )
src/node-utils.js:129
Load a CA bundle file and return an array of certificates
Parameters:-
filename<String>name of the file to parse
array of certificates data
log( head, params )
src/node-utils.js:287
Log function for SAGE2, adds a header with color
Parameters:mergeObjects( a, b, ignore )
src/node-utils.js:613
Merges object a and b into b
Parameters:return true if b was modified
mkdirParent( dirPath )
src/node-utils.js:528
Creates recursively a series of folders if needed (synchronous function and throws error)
Parameters:-
dirPath<String>path to be created
null or directory created
monitorFolders( folders, excludesFiles, excludesFolders, callback )
src/node-utils.js:567
Place a callback on a list of folders to monitor callback triggered when a change is detected: this.root contains the monitored folder parameter contains the following list: addedFiles, modifiedFiles, removedFiles, addedFolders, modifiedFolders, removedFolders
Parameters:registerSAGE2( config )
src/node-utils.js:450
Register SAGE2 with EVL server
Parameters:-
config<Object>local SAGE2 configuration
sanitizedURL( aURL )
src/node-utils.js:254
Cleanup URL from XSS attempts
Parameters:-
aURL<String>a URL we received from a request
cleanup string
secureContext( key, crt, ca )
src/node-utils.js:109
Create a SSL context / credentials
Parameters:secure context
_NODE_VERSION <Number>src/node-utils.js:47
Parse and store NodeJS version number: detect version 0.10.x or newer
SAGE2: node-utils