Created
September 1, 2015 03:18
-
-
Save bschwind/ed5aeb98636b68d2103d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
readFile("filename.txt", function(err, data) { | |
console.log("5 seconds have elapsed"); | |
if (err) { return; } | |
readFile("otherfile.txt", function(err, data) { | |
console.log("10 seconds have elapsed"); | |
if (err) { return; } | |
writeFileToNetwork(data, function(err, response) { | |
if (err) { return; } | |
console.log("complete"); | |
}); | |
}); | |
}); | |
readFile("otherfile.txt", function(err, data) { | |
console.log(data); | |
}); | |
readFile("filename.txt") | |
.then(function (data) { | |
console.log(data); | |
return readFile("otherfile.txt"); | |
}) | |
.then(function (otherData) { | |
console.log(otherData); | |
return writeFileToNetwork(otherData); | |
}) | |
.then(function (response) { | |
console.log("complete"); | |
}) | |
.catch(function (err) { | |
console.error(err); | |
}); | |
// var data = readFile("filename.txt"); - 5 secs | |
// var otherFile = readFile("otherfile.txt"); - 5 secs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment