koa-static-security
-
拦截静态文件恶意路径
-
更好的静态文件中间件
Installation
$ npm install koa-static-security
API
var koa = ;var app = ;app;
opts
options object.
Options
maxage
Browser cache max-age in milliseconds. defaults to 0hidden
Allow transfer of hidden files. defaults to falseindex
Default file name, defaults to noneifModifiedSinceSupport
by sending a 304 (not modified) response. Defaults to trueformat
Allow trailing slashes for directories (e.g. /directory and /directory. Defaults to true
Example
var serve = ;var koa = ;var app = ; // $ GET /package.jsonapp; // $ GET /hello.txtapp; // or use absolute pathsapp; app; console;
License
MIT