Created
July 8, 2015 10:47
-
-
Save PaulSec/4466bc6d578c5d15c556 to your computer and use it in GitHub Desktop.
Service static cert using Node.js
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
var http = require('http'), | |
path = require('path'), | |
fs = require('fs'); | |
http.createServer(function(req, res) { | |
filename = './cacert.crt' | |
path.exists(filename, function(exists) { | |
res.writeHead(200, {'Content-disposition': 'attachment; filename=cacert.crt', 'Content-Type': 'text/plain'}); | |
var fileStream = fs.createReadStream(filename); | |
fileStream.pipe(res); | |
}); //end path.exists | |
}).listen(1337); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment