Created
October 31, 2018 12:09
-
-
Save ufocoder/2cd3537aa80a57f550819ac0749e71b6 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
| router.get(url, function (req, res) { | |
| function handleSuccess (file) { | |
| res.writeHead(200, { "Content-Type": "application/octet-stream" }); | |
| res.write(file); | |
| res.end(); | |
| } | |
| function handleError (err) { | |
| res.writeHead(404); | |
| res.end(); | |
| } | |
| const callback = higherOrderNodeCallback(handleSuccess, handleError); | |
| readFile(filePath, callback); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment