-
Notifications
You must be signed in to change notification settings - Fork 3
FTP_SimpleQueue
FTP# SimpleQueue
at the example below to see how we override the callback
function to perform additional actions before exiting
the queue and loading the next one.
Functions created with this provide a synchronized queue
that is asynchronous in itself, so items will be processed
in the order they are received, but this will happen
immediately. Meaning, if you make a dozen sequential calls
to FTP#filemtime they will all be read immediately,
queued in order, and then processed one after the other.
Name | Type | Description |
---|---|---|
command |
string |
The command that will be issued ie: “CWD foo” |
- Source:
- To Do:
-
- - make OO – double check endproc and then callback ? or callback and endproc
- Type
-
function
//the current implementation of FTP.rename is preferred,
//this is merely being used as an example
var myCustomRename = (function () {
var myQueueManager = ftp.SimpleQueue.create(‘RNFR’);
return function (pathArray, callback) {
var from = pathArray0,
to = pathArray1;
//override the callback, SimpleQueue’s expect the
//first parameter to be a string
myQueueManager(from, function (err, data) {
if (err) {
dbg(err);
} else {
//provide custom function and trigger callback when done
ftp.raw(’RNTO ’ + to, callback);
}
});
}
}());
Name | Type | Description |
---|---|---|
filepath |
string |
The location of the remote file to process the set command. |
callback |
function |
The callback function to be issued. |
runNow |
boolean |
Run the command immediately. Careful, concurrent connections will likely end in a socket error. This is meant for fine grained control over certain scenarios wherein the process is part of a running queue and you need to perform an ftp action prior to the FTP#endproc event firing and execing the next queue. |
- fileTransferComplete
- queueEmpty
- error
- ready