IPWorks SSH 2020 Node.js Edition

Questions / Feedback?

QueueFile Method

Adds a file to the transfer queue.

Syntax

sftp.queueFile(localFile, remoteFile, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method adds a file to the queue of files that will be transferred.

It is not required to use this method, however this extends the ability of the class to allow for multiple simultaneous file transfers.

To simply transfer a file without using this method you need only set LocalFile, RemoteFile, and call Upload or Download as appropriate. This method allows you to instead queue multiple files before beginning a transfer.

When a file is queued it will not be transferred until the Upload or Download method is called. If multiple files are queued the files will be transferred simultaneously. The SimultaneousTransferLimit setting controls the maximum number of simultaneous transfers.

The Upload or Download method will not return until the Queue has been completely processed. This method may be called from within events in order to add additional files to the Queue before processing is complete.

To clear the queue call ResetQueue. This will not affect current transfers.

To cancel and individual file transfer set the Cancel parameter of the Transfer event to true. The rest of the queue will continue to process as normal.

The Interrupt method may be called to immediately stop all current transfers.

In the event of a file specific error the Error event will fire and the LocalFile and RemoteFile event parameters can be used to identify the file to which the error applies.

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 Node.js Edition - Version 20.0 [Build 8501]