Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
您最多能選擇 25 個主題 主題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字。
 
 

31 行
861 B

const utils = require('../utils/utils.js');
module.exports=
{
/**Sends the user an image from the specified fileName.
*
* @param result
* @param fileName
*/
main: function(result, fileName, cache)
{
//result.contentType = 'image/png';
result.writeHead(200, {'Content-Type': 'image/png', 'Cache-Control': 'max-age=3600'});
var img = cache.get(fileName);
if(img == null)
{
utils.include("." + fileName).then(function(content)
{
result.write(content);
result.end();
cache.put(content);
});
}
else
{
result.write(img);
result.end();
}
}
};