Global

Properties

PropertyTypeDescription
debugMode Boolean

Debug mode flag.

Methods

MethodReturnsDescription
atob() String

Encode a string to Base64.

btoa() String

Decode a Base64-encoded string.

encodeHTML() String

Encode a string for safe use in HTML.

include() void

Inserts the content of the JSS script file at the given path into the script file that calls the function.

md5() String

Compute MD5 hash of input string.

publish() void

Adds the given object (usually a function) to the global scope using the given name.

sleep() void

Pause script execution for specified time.

Property Details

debugMode :Boolean

Description:
  • Debug mode flag. True when running in debug build.

Debug mode flag. True when running in debug build.

Type:
  • Boolean

Method Details

atob(str) → {String}

Description:
  • Encode a string to Base64.

Parameters:
Name Type Description
str String

String to encode

Returns:

Base64-encoded string

Type
String

btoa(str) → {String}

Description:
  • Decode a Base64-encoded string.

Parameters:
Name Type Description
str String

Base64-encoded string to decode

Returns:

Decoded string

Type
String

encodeHTML(str) → {String}

Description:
  • Encode a string for safe use in HTML. Converts special characters like <, >, &, " to HTML entities.

Parameters:
Name Type Description
str String

String to encode

Returns:

HTML-encoded string

Type
String

include(scriptPath)

Description:
  • Inserts the content of the JSS script file at the given path into the script file that calls the function. The scope of the script is the same as the scope from which the function was called.

Parameters:
Name Type Description
scriptPath String

path of JSS script file.

md5(input) → {String}

Description:
  • Compute MD5 hash of input string.

Parameters:
Name Type Description
input String

String to hash

Returns:

Hex-encoded MD5 hash (32 characters)

Type
String

publish(name, funcOrObj, instructionsopt)

Description:
  • Adds the given object (usually a function) to the global scope using the given name. If the published object is a function then it will be made available via RPC unless 'serverOnly' is supplied in the instructions argument.

    Functions declared in the global scope and those referenced by publish (without the serverOnly flag) are automatically made available via RPC when the URL of the .jss file in which they're defined are referenced by allowed <script> tag in HTML. The Javascript code required to call them is automatically generated by CompleteFTP. Refer to JSS Web-App Basics for more information.

    The following example illustrates some usages:

    function globalFunction() {
    }
    
    (function () {
        function publishedFunction() {
        }
    
        function serverOnlyFunction() {
        }
    
        function internalFunction() {
        }
    
        publish("publishedFunction", publishedFunction);
        publish("serverOnlyFunction", serverOnlyFunction, { serverOnly: true });
    }());
    

    Both globalFunction() and publishedFunction() are available for RPC, the former because it's a global function and the latter because it's published using the publish function. Neither internalFunction() and serverOnlyFunction() are not available via RPC, but serverOnlyFunction() may be called by any other .jss file that includes it using the include function because it's published with the serverSide flag.

Parameters:
Name Type Attributes Description
name String

Name via which the object is to be referenced

funcOrObj FunctionOrObject

Object or function to be published

instructions Object <optional>

Specifies how the object is to be published.

Properties
Name Type Attributes Description
serverOnly Object <optional>

If this property is true then the function will not be made available via RPC.

maxCallsPerMinute Object <optional>

Maximum number of RPC invocations allowed per minute (default is 100).

sleep(milliseconds)

Description:
  • Pause script execution for specified time. Maximum allowed sleep time is 60,000 milliseconds (1 minute).

Parameters:
Name Type Description
milliseconds Number

Time to sleep in milliseconds (max 60000)

Type Definitions

ChangeConfig2Callback(config)

Description:
  • Callback used by the changeConfig2 method.

Parameters:
Name Type Description
config Config2

Object encapsulating the CompleteFTP configuration (Version 2 API).

ChangeConfigCallback(config)

Description:
  • Callback used by the changeConfig method.

Parameters:
Name Type Description
config Config1

Object encapsulating the CompleteFTP configuration.

Config1_Connection

Description:
  • Connection information.

Properties:
Name Type Description
sessionID String

ID of session to which the connection belongs.

siteID String

ID of site that the connection is connected to.

connectTime Date

Time when the connection was established.

loginTime Date

Time when the client logged in.

userName String

Username of the session.

siteName String

Name of site that the connection is connected to.

localPort Number

Local port that that the connection is connected to.

remoteAddress String

IP address of client.

remotePort Number

Port of client end of the connection.

protocol String

Protocol being used.

diskUsage Number

Disk usage (null if no quota is set for the user).

Connection information.

Type:
  • Object

FileInfo

Description:
  • Represents a single file or folder in a file listing

Properties:
Name Type Description
name String

Name of the file or folder

length Number

Length of the file (0 if folder)

isDirectory Boolean

Is this a folder?

modified Date

Date when the file (or folder - excluding contents) was last modified.

permissions String

Permissions of the file or folder.

owner String

Name of the user account which owns the file or folder.

group String

Name of the group to which the folder belongs.

Represents a single file or folder in a file listing

Type:
  • Object

HttpConfiguration

Description:
  • Configuration of HTTP request

Properties:
Name Type Description
params Object

Query arguments. These may alternatively be included in the url argument.

timeout Number

Timeout in milliseconds.

headers Object

HTTP headers.

contentType Object

MIME type.

Configuration of HTTP request

Type:
  • Object

HttpResponse

Description:
  • Encapsulates the response to a HTTP request.

Properties:
Name Type Description
body String

The body of the response

status HttpResponseStatus

The response code and its description

Encapsulates the response to a HTTP request.

Type:
  • Object

HttpResponseStatus

Description:
  • Encapsulates the status of an HTTP response

Properties:
Name Type Description
code number

The response code

description String

The response description

Encapsulates the status of an HTTP response

Type:
  • Object

IdentityProvider

Description:
  • Contains information about an SAML IDP (IDentity Provider)

Properties:
Name Type Description
name String

Name of the IDP.

id String

Identifier of the IDP (usually its URL).

Contains information about an SAML IDP (IDentity Provider)

Type:
  • Object

PublicKeyInfo

Description:
  • Public key information.

Properties:
Name Type Description
type String

The algorithm of the key: DSA, RSA, ECDSAsha2Nistp256, ECDSAsha2Nistp384 or ECDSAsha2Nistp512.

fingerprint String

The fingerprint of the key.

encodedKey String

The same key encoded in OpenSSH format (no comment included).

Public key information.

Type:
  • Object

ShareConfig

Description:
  • Specifies how the file is to be shared, as well as its size.

Properties:
Name Type Description
expiryDateUTC Date

Expiry date of the share (UTC).

expectedFileSize Number

Size of the file to be shared.

password String

(Optional) password of the share. If no password is provided then the file is shared without a password.

Specifies how the file is to be shared, as well as its size.

Type:
  • Object

ShareDirectoryPaths

Description:
  • Directory paths related to sharing.

Properties:
Name Type Description
globalShareDirectoryPath String

The virtual file-system path of the sharing index (usually /Shares).

userShareDirectoryPath String

The path of the user's shared files (usually /Home/UserName/Shares).

Directory paths related to sharing.

Type:
  • Object

ShareInfo

Description:
  • Contains all information about a shared file.

Properties:
Name Type Description
fileName String

Name of the file.

sharePath String

Path of the share within the virtual file-system. This, appended to the hostname, is the sharing URL.

id String

Unique identifier of the share file (last part of the sharePath)

expectedFileSize Number

Size of the file once it's fully uploaded.

actualFileSize Number

Current size of the file on the server (it may be less than the expectedFileSize if it hasn't finished uploading).

expiryDateUTC Date

Expiry date of the sharing (UTC) or null of the file is not shared.

modifiedDateUTC Date

Time when the sharing information was last modified (note this is not the same as the modification time of the file itself).

createdDateUTC Date

Time when the sharing information was created.

fileModifiedDateUTC Date

Time when the file was last modified (note this is different from the modification time of the share).

Contains all information about a shared file.

Type:
  • Object

SingleSignOn

Description:
  • Contains information about SAML Single Sign-On (SSO).

Properties:
Name Type Description
enabled Boolean

Is SAML SSO enabled?

path String

Path under which SAML requests are processed (usually /SAML).

identityProviders Array.<IdentityProvider>

Array of SAML IDPs (IDentity Providers).

Contains information about SAML Single Sign-On (SSO).

Type:
  • Object

SiteCertificate

Description:
  • Provides access to JWK objects representing the site's certificate and that certificate's public key, as well as methods for decrypting and encrypting strings with the certificate's private key.

Properties:
Name Type Description
toJWK function

Returns the site certificate as a JWK object.

publicKeyToJWK function

Returns the site certificate's public key as a JWK object.

decryptWithPrivateKey function

decrypts the given string using the site certificate's private key.

encryptWithPrivateKey function

encrypts the given string using the site certificate's private key.

Provides access to JWK objects representing the site's certificate and that certificate's public key, as well as methods for decrypting and encrypting strings with the certificate's private key.

Type:
  • Object

SiteInfo

Description:
  • Contains information about a site

Properties:
Name Type Description
name String

Name of the site. This name is not shown to users.

label String

Name of the site shown to users where required, such as in two-factor authentication (Enterprise Edition)..

welcomeMessage String

Welcome-message of the site.

singleSignOn SingleSignOn

Single Sign-on (SAML) settings.

loginPath String

Path to the login page (usually /Login).

publicAccessEnabled Boolean

True if public HTTP/HTTPS access is enabled on this site.

httpEnabled Boolean

True if HTTP is enabled on this site.

httpsEnabled Boolean

True if HTTPS is enabled on this site.

sharingEnabled Boolean

True if sharing is enabled on this site.

tfaEnabled Boolean

True if two-factor authentication is enabled on this site.

allowOverWriteOnRename Boolean

True if existing files with same names will be overwritten when renaming.

logoutPath String

Path to the logout page (usually /Logout).

accountPath String

Path to the account management page (usually /Account)

includePath String

Path to the include folder (usually /Include)

certificate SiteCertificate

Site certificate.

getMimeType function

Returns the MIME type for a given file extension.

isHostNameAllowed function

Checks if a hostname is allowed for this site.

Contains information about a site

Type:
  • Object