Last active
November 26, 2015 09:30
-
-
Save MadaraUchiha/2e4bf78fd57e2a531fa4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ivals = [/* lots of ivals here */]; | |
let c = new Ftp(); | |
function putItem(ftp, item) { | |
return new Promise((resolve, reject) => | |
ftp.put(item, item, (err) => err ? reject(err) : resolve())); | |
} | |
ivals.reduce((promise, ival) => | |
promise.then(() => { | |
console.log(`Transferring [${ival}]`); | |
return putItem(c, ival) | |
.catch(console.log); // Log errors! | |
}), Promise.resolve()); // Start with an empty promise. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment