-
Notifications
You must be signed in to change notification settings - Fork 0
queue API methods rename
Steve edited this page Apr 29, 2020
·
1 revision
batchRename(fnRename: (entry: IListEntry) => Promise<string>):void ~> boolean
Renames each file (or folder) currently collected in the queue using a custom method "fnRename". If you return the original name unchanged (entry.src) the entry will be skipped.
const queue = client.createQueue({continueOnError:false});
queue.login("user", "password");
queue.listServer("images/foo", {recursive:true});
// batch rename the entries
queue.batchRename((entry: IListEntry) => {
return new Promise((resolve) => {
return resolve("renamed_" + entry.src);
})
});
// the following line actually starts the execution
queue.run();
Note: the methods above just add the commands to the queue. Execution starts when calling queue.run() or queue.runWithResults(). The ~> indicates the result type.
Documentation
-
Interfaces