Integral FTP

Class FTPClient

Object
   |
   +--FTPClient

class FTPClient


FTPClient is the main interface for the Integral FTP library. It contains methods for connecting to FTP servers, downloading and uploading files, listing local and remote directories, and renaming and deleting local and remote files. Please refer to the Integral FTP Developer's Guide for a broad description of how this class may be used.
Defined in ftpclient.js


Field Summary
 Object _instance
          
 Object dateLanguages
          Language(s) to use when attempting parse dates in directory listings.
 string id
          Unique identifier for this instance of FTPClient.
 string initialRemoteDirectory
          Initial remote directory on FTP server.
 Object localSeparator
          Path separator of local file-system.
 boolean localSortAscending
          Flag controlling the sort-order (ascending or descending) of files returned by localDirectoryList().
 string localSortColumn
          Attribute by which the list files returned by localDirectoryList() are sorted.
 string logLevel
          Level of logging (Possible values are "OFF", "ERROR", "INFO", "DEBUG" and "ALL").
 boolean logToFile
          If true then logging will be written to a file called "IntegralFTP.log" in the machine's temporary directory.
 int maxPoolSize
          Maximum number of connections that the client makes with the server.
 int minPoolSize
          Minimum number of connections that the client makes with the server.
 int minTransferNotifyPeriod
          Minimum number of milliseconds between progress updates.
 string password
          Password of account on FTP server
 string protocol
          File transfer protocol to use (FTP, FTPS or SFTP).
 string remoteHost
          Domain name or IP address (and optionally port) of FTP server.
 boolean remoteSortAscending
          Flag controlling the sort-order (ascending or descending) of files returned by remoteDirectoryList.
 string remoteSortColumn
          Attribute by which the list files returned by remoteDirectoryList are sorted.
 boolean showSplash
          Controls whether or not the EnterpriseDT splash screen is displayed on start-up.
 string splashImageURL
          URL of splash image.
 int transferBufferSize
          Size of the data buffers (in bytes) used in reading and writing to the server.
 int transferNotifyInterval
          Deprecated: Use minTransferNotifyPeriod instead.
 string userName
          User-name of account on FTP server
 <final> Object WRITEMODE_APPEND
          Constant used in downloadFile() and uploadFile() to direct FTPClient to append to the existing file (if any).
 <final> Object WRITEMODE_OVERWRITE
          Constant used in downloadFile() and uploadFile() to direct FTPClient to overwrite any existing file with the same name.
 <final> Object WRITEMODE_RESUME
          Constant used in downloadFile() and uploadFile() to direct FTPClient to resume any previous transfer from the point at which is was stopped last time.
 
Constructor Summary
FTPClient()
            Constructs a new FTPClient object.
 
Method Summary
 int alert(<string> message)
           Shows a message-box with an OK button [ASYNCHRONOUS - no callback].
 int ask(<string> message, <callback> callbackFunction, <object> tag, <string> button1Text, <string> button2Text, <string> button3Text)
           Prompts the user with a message and allows them to press one of two or three buttons [ASYNCHRONOUS - calls user-specified method when complete].
 void cancelTransfer(<int> transferID)
           Cancels the transfer specified by the given identifier.
 int changeDirectory(<string> directory, <object> tag)
           Changes the working directory on the server [ASYNCHRONOUS - calls onChangeDirectory() when complete].
 int connect(<object> tag)
           Connect to an FTP server [ASYNCHRONOUS - calls onConnect() when complete].
 int createDirectory(<string> directory, <object> tag)
           Creates a new directory on the server [ASYNCHRONOUS - calls onCreateDirectory() when complete].
 int deleteDirectory(<string> remoteDirectoryName, <object> tag)
           Delete a directory [ASYNCHRONOUS - calls onDeleteDirectory() when complete].
 int deleteFile(<string> remoteFileName, <object> tag)
           Delete a file [ASYNCHRONOUS - calls onDeleteFile() when complete].
 int directoryList(<string> directory, <object> tag)
           List the contents of a remote directory [ASYNCHRONOUS - calls onDirectoryList() when complete].
 int disconnect(<object> tag)
           Disconnects from the server [ASYNCHRONOUS - calls onDisconnect() when complete].
 int downloadFile(<string> localFileName, <string> remoteFileName, <int> writeMode, <object> tag)
           Downloads a file [ASYNCHRONOUS - calls onDownloadFile() when complete].
 int downloadText(<string> remoteFileName, <object> tag)
           Downloads a file into a JavaScript string [ASYNCHRONOUS - calls onDownloadText() when complete].
 int executeCommand(<string> command, <object> tag)
           Executes an arbitrary FTP command.
 int exists(<string> remoteFileName, <object> tag)
           Checks for the existence of a file [ASYNCHRONOUS - calls onExists() when complete].
 string[] getAllLogLevels()
           Returns an array of strings containing the names of all the valid logging levels.
 string getCharacterSet()
           Returns the current character-set.
 string getConnectMode()
           Returns the current connection-mode.
 int getLocalAcceptorPort()
           Gets the number of the port to which HTTP requests may be directed when viewing the contents of a local file.
 string getLocalHomeDirectory()
           Gets the name of the user's home directory.
 string getLocalTempDirectory()
           Gets the name of the user's TEMP directory.
 string getLogLevel()
           Returns the current logging level.
 int getRemoteAcceptorPort()
           Gets the number of the port to which HTTP requests may be directed when viewing the contents of a remote file.
 string getTransferType()
           Returns the current transfer-type.
 string getWorkingDirectory()
           Get the current remote working directory.
 void initialize(<string> jarURL, <boolean> showSplash, <string> logLevel, <boolean> logToFile, <int> minPoolSize, <int> maxPoolSize)
           Initializes the FTPClient instance [ASYNCHRONOUS - calls onInitialize() when complete].
 boolean isConnected()
           Returns true if this FTPClient is currently connected to a server.
 int isInitialized()
           Returns true if the FTPClient has been initialized.
 boolean isKeepAliveEnabled()
           Is the connection pool's keep alive thread enabled, i.e.
 Object isRemoteHostValid(hostName)
           Returns true is the given host-name can be parsed.
 boolean isViewCachingEnabled()
           Returns true if view-caching is enabled.
 int localCreateDirectory(<string> directoryName, <object> tag)
           Creates a directory on the local disk [ASYNCHRONOUS - calls onLocalCreateDirectory() when complete].
 int localDeleteFile(<string> fileName, <object> tag)
           Delete a local file [ASYNCHRONOUS - calls onLocalDeleteFile() when complete].
 int localDirectoryList(<string> dirPath, <object> tag)
           List the contents of a local directory [ASYNCHRONOUS - calls onLocalDirectoryList() when complete].
 int localModifiedTime(<string> fileName, <object> tag)
           Get the last-modified time of a local file [ASYNCHRONOUS - calls onLocalModifiedTime() when complete].
 int localRename(<string> oldFileName, <string> newFileName, <object> tag)
           Rename a local file [ASYNCHRONOUS - calls onLocalRename() when complete].
 int localSize(<string> fileName, <object> tag)
           Get the size of a local file [ASYNCHRONOUS - calls onLocalSize() when complete].
 int modifiedTime(<string> remoteFileName, <object> tag)
           Gets the last-modified time of a file [ASYNCHRONOUS - calls onModifiedTime() when complete].
 callback onChangeDirectory(<FTPCallbackStatus> callbackStatus, <string> remoteDirectory)
           Callback for the changeDirectory() method.
 callback onConnect(<FTPCallbackStatus> callbackStatus)
           Callback for the connect() method.
 callback onCreateDirectory(<FTPCallbackStatus> callbackStatus, <string> remoteDirectory)
           Callback for the createDirectory() method.
 callback onDeleteDirectory(<FTPCallbackStatus> callbackStatus, <string> remoteDirectoryName)
           Callback for the deleteDirectory() method.
 callback onDeleteFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)
           Callback for the deleteFile() method.
 callback onDirectoryList(<FTPCallbackStatus> callbackStatus, <string> remoteDirectory, <FTPFileList> fileList)
           Callback for the directoryList() method.
 callback onDisconnect(<FTPCallbackStatus> callbackStatus, <int> reasonCode, <string> reasonMessage)
           Callback for the disconnect() method.
 callback onDownloadFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)
           Callback for the downloadFile() method.
 callback onDownloadText(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <string> text)
           Callback for the downloadText() method.
 callback onError(<FTPCallbackStatus> callbackStatus)
           Callback for all errors.
 callback onExecuteCommand(<FTPCallbackStatus> callbackStatus, <string> command, <string> result)
           Callback for the executeCommand() method.
 callback onExists(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <boolean> exists)
           Callback for the exists() method.
 callback onInitialize(<FTPCallbackStatus> callbackStatus)
           Callback for the initialize() method.
 callback onLocalCreateDirectory(<FTPCallbackStatus> callbackStatus, <string> localDirectory)
           Callback for the localCreateDirectory() method.
 callback onLocalDeleteFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)
           Callback for the localDeleteFile() method.
 callback onLocalDirectoryList(<FTPCallbackStatus> callbackStatus, <string> localDirectory, <FTPFileList> fileList)
           Callback for the localDirectoryList() method.
 callback onLocalModifiedTime(<FTPCallbackStatus> callbackStatus, <string> localFileName, <Date> modTime)
           Callback for the localModifiedTime() method.
 callback onLocalRename(<FTPCallbackStatus> callbackStatus, <string> fromName, <string> toName)
           Callback for the localRename() method.
 callback onLocalSize(<FTPCallbackStatus> callbackStatus, <string> localFileName, <int> size)
           Callback for the localSize() method.
 callback onModifiedTime(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <Date> modTime)
           Callback for the modifiedTime() method.
 callback onRename(<FTPCallbackStatus> callbackStatus, <string> fromName, <string> toName)
           Callback for the rename() method.
 callback onSize(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <int> size)
           Callback for the size() method.
 callback onTransferProgress(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <int> byteCount)
           Callback for transfer-progress updates.
 callback onUploadFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)
           Callback for the uploadFile() method.
 callback onUploadText(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)
           Callback for the uploadText() method.
 int promptFile(<boolean> isOpen, <callback> callbackFunction, <object> tag, <string> title, <string> directory, <string> file)
           Prompts the user for a file [ASYNCHRONOUS - calls user-specified method when complete].
 int promptFiles(<callback> callbackFunction, <object> tag, <string> title, <string> directory)
           Prompts the user for multiple files.
 void registerMimeType(<string> extension, <string> mimeType)
           Registers an extension as a particular MIME type.
 int rename(<string> fromFileName, <string> toFileName, <object> tag)
           Rename a file [ASYNCHRONOUS - calls onRename() when complete].
 void setCharacterSet(<string> charSet)
           Sets the current character-set.
 void setConnectMode(<string> mode)
           Sets the connection-mode of data-channels to "active" or "passive".
 void setKeepAliveEnabled(<boolean> enabled)
           Change the connection pool keep alive setting, switching it on or off.
 void setLogLevel(<string> level)
           Sets the current logging level.
 void setTemplateURLs(<string> localViewURL, localTextEditorURL, localHTMLEditorURL, <string> remoteViewURL, remoteTextEditorURL, remoteHTMLEditorURL)
           Sets the view and editing templates.
 void setTransferType(type)
           Sets the transfer-type of data-channels to "ascii" or "passive".
 void setViewCachingEnabled(<boolean> enable)
           Controls whether view caching is enabled (the default is true).
 int size(<string> remoteFileName, <object> tag)
           Gets the size of a file [ASYNCHRONOUS - calls onSize() when complete].
 int uploadFile(<string> localFileName, <string> remoteFileName, <int> writeMode, <object> tag)
           Uploads a file [ASYNCHRONOUS - calls onUploadFile() when complete].
 int uploadText(<string> text, <string> remoteFileName, <object> tag)
           Uploads a JavaScript string to a file on the server [ASYNCHRONOUS - calls onUploadText() when complete].

Field Detail

_instance

Object _instance

dateLanguages

Object dateLanguages

id

string id

initialRemoteDirectory

string initialRemoteDirectory

localSeparator

Object localSeparator

localSortAscending

boolean localSortAscending

localSortColumn

string localSortColumn

logLevel

string logLevel

logToFile

boolean logToFile

maxPoolSize

int maxPoolSize

minPoolSize

int minPoolSize

minTransferNotifyPeriod

int minTransferNotifyPeriod

password

string password

protocol

string protocol

remoteHost

string remoteHost

remoteSortAscending

boolean remoteSortAscending

remoteSortColumn

string remoteSortColumn

showSplash

boolean showSplash

splashImageURL

string splashImageURL

transferBufferSize

int transferBufferSize

transferNotifyInterval

int transferNotifyInterval

userName

string userName

WRITEMODE_APPEND

<final> Object WRITEMODE_APPEND

WRITEMODE_OVERWRITE

<final> Object WRITEMODE_OVERWRITE

WRITEMODE_RESUME

<final> Object WRITEMODE_RESUME

Constructor Detail

FTPClient

FTPClient()

Method Detail

alert

int alert(<string> message)

ask

int ask(<string> message, <callback> callbackFunction, <object> tag, <string> button1Text, <string> button2Text, <string> button3Text)

cancelTransfer

void cancelTransfer(<int> transferID)

changeDirectory

int changeDirectory(<string> directory, <object> tag)

connect

int connect(<object> tag)

createDirectory

int createDirectory(<string> directory, <object> tag)

deleteDirectory

int deleteDirectory(<string> remoteDirectoryName, <object> tag)

deleteFile

int deleteFile(<string> remoteFileName, <object> tag)

directoryList

int directoryList(<string> directory, <object> tag)

disconnect

int disconnect(<object> tag)

downloadFile

int downloadFile(<string> localFileName, <string> remoteFileName, <int> writeMode, <object> tag)

downloadText

int downloadText(<string> remoteFileName, <object> tag)

executeCommand

int executeCommand(<string> command, <object> tag)

exists

int exists(<string> remoteFileName, <object> tag)

getAllLogLevels

string[] getAllLogLevels()

getCharacterSet

string getCharacterSet()

getConnectMode

string getConnectMode()

getLocalAcceptorPort

int getLocalAcceptorPort()

getLocalHomeDirectory

string getLocalHomeDirectory()

getLocalTempDirectory

string getLocalTempDirectory()

getLogLevel

string getLogLevel()

getRemoteAcceptorPort

int getRemoteAcceptorPort()

getTransferType

string getTransferType()

getWorkingDirectory

string getWorkingDirectory()

initialize

void initialize(<string> jarURL, <boolean> showSplash, <string> logLevel, <boolean> logToFile, <int> minPoolSize, <int> maxPoolSize)

isConnected

boolean isConnected()

isInitialized

int isInitialized()

isKeepAliveEnabled

boolean isKeepAliveEnabled()

isRemoteHostValid

Object isRemoteHostValid(hostName)

isViewCachingEnabled

boolean isViewCachingEnabled()

localCreateDirectory

int localCreateDirectory(<string> directoryName, <object> tag)

localDeleteFile

int localDeleteFile(<string> fileName, <object> tag)

localDirectoryList

int localDirectoryList(<string> dirPath, <object> tag)

localModifiedTime

int localModifiedTime(<string> fileName, <object> tag)

localRename

int localRename(<string> oldFileName, <string> newFileName, <object> tag)

localSize

int localSize(<string> fileName, <object> tag)

modifiedTime

int modifiedTime(<string> remoteFileName, <object> tag)

onChangeDirectory

callback onChangeDirectory(<FTPCallbackStatus> callbackStatus, <string> remoteDirectory)

onConnect

callback onConnect(<FTPCallbackStatus> callbackStatus)

onCreateDirectory

callback onCreateDirectory(<FTPCallbackStatus> callbackStatus, <string> remoteDirectory)

onDeleteDirectory

callback onDeleteDirectory(<FTPCallbackStatus> callbackStatus, <string> remoteDirectoryName)

onDeleteFile

callback onDeleteFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)

onDirectoryList

callback onDirectoryList(<FTPCallbackStatus> callbackStatus, <string> remoteDirectory, <FTPFileList> fileList)

onDisconnect

callback onDisconnect(<FTPCallbackStatus> callbackStatus, <int> reasonCode, <string> reasonMessage)

onDownloadFile

callback onDownloadFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)

onDownloadText

callback onDownloadText(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <string> text)

onError

callback onError(<FTPCallbackStatus> callbackStatus)

onExecuteCommand

callback onExecuteCommand(<FTPCallbackStatus> callbackStatus, <string> command, <string> result)

onExists

callback onExists(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <boolean> exists)

onInitialize

callback onInitialize(<FTPCallbackStatus> callbackStatus)

onLocalCreateDirectory

callback onLocalCreateDirectory(<FTPCallbackStatus> callbackStatus, <string> localDirectory)

onLocalDeleteFile

callback onLocalDeleteFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)

onLocalDirectoryList

callback onLocalDirectoryList(<FTPCallbackStatus> callbackStatus, <string> localDirectory, <FTPFileList> fileList)

onLocalModifiedTime

callback onLocalModifiedTime(<FTPCallbackStatus> callbackStatus, <string> localFileName, <Date> modTime)

onLocalRename

callback onLocalRename(<FTPCallbackStatus> callbackStatus, <string> fromName, <string> toName)

onLocalSize

callback onLocalSize(<FTPCallbackStatus> callbackStatus, <string> localFileName, <int> size)

onModifiedTime

callback onModifiedTime(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <Date> modTime)

onRename

callback onRename(<FTPCallbackStatus> callbackStatus, <string> fromName, <string> toName)

onSize

callback onSize(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <int> size)

onTransferProgress

callback onTransferProgress(<FTPCallbackStatus> callbackStatus, <string> remoteFileName, <int> byteCount)

onUploadFile

callback onUploadFile(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)

onUploadText

callback onUploadText(<FTPCallbackStatus> callbackStatus, <string> remoteFileName)

promptFile

int promptFile(<boolean> isOpen, <callback> callbackFunction, <object> tag, <string> title, <string> directory, <string> file)

promptFiles

int promptFiles(<callback> callbackFunction, <object> tag, <string> title, <string> directory)

registerMimeType

void registerMimeType(<string> extension, <string> mimeType)

rename

int rename(<string> fromFileName, <string> toFileName, <object> tag)

setCharacterSet

void setCharacterSet(<string> charSet)

setConnectMode

void setConnectMode(<string> mode)

setKeepAliveEnabled

void setKeepAliveEnabled(<boolean> enabled)

setLogLevel

void setLogLevel(<string> level)

setTemplateURLs

void setTemplateURLs(<string> localViewURL, localTextEditorURL, localHTMLEditorURL, <string> remoteViewURL, remoteTextEditorURL, remoteHTMLEditorURL)

setTransferType

void setTransferType(type)

setViewCachingEnabled

void setViewCachingEnabled(<boolean> enable)

size

int size(<string> remoteFileName, <object> tag)

uploadFile

int uploadFile(<string> localFileName, <string> remoteFileName, <int> writeMode, <object> tag)

uploadText

int uploadText(<string> text, <string> remoteFileName, <object> tag)

Integral FTP

Documentation generated by JSDoc on Tue Jan 24 10:46:49 2012