这样写不对么?不能成功
发布于 10 年前 作者 smilingxinyi 3295 次浏览 最后一次编辑是 8 年前

if(decodeURI(url.parse(req.url).pathname)=="/方正卡通简体.ttf"){ fs.readFile("./方正卡通简体.ttf",Buffer,function(err,data){ zlib.gzip(data, function(err,buffer){ if(!err){ res.writeHead(200,{‘Content-Type’:“application/x-font-ttf”,“Content-Length”:data.length,“Accept-Encoding”:‘gzip’}); res.end(buffer,“binary”); } else{ console.log(err); } }) }) }

不能用 TAT

4 回复

没有用框架?

head里用标准的下载头部。不要用TTF头。

@MiguelValentine 好的。。我试试,多谢

@nihgwu 没。一个小demo没必咩- -

回到顶部