New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

koa-static-security

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-static-security

koa static security

latest
npmnpm
Version
0.0.11
Version published
Maintainers
1
Created
Source

koa-static-security

基于koa-better-static修改

  • 拦截静态文件恶意路径

  • 更好的静态文件中间件

Installation

$ npm install koa-static-security

API

var koa = require('koa');
var app = koa();
app.use(require('koa-static-security')(root, opts));
  • opts options object.

Options

  • maxage Browser cache max-age in milliseconds. defaults to 0
  • hidden Allow transfer of hidden files. defaults to false
  • index Default file name, defaults to none
  • ifModifiedSinceSupport by sending a 304 (not modified) response. Defaults to true
  • format Allow trailing slashes for directories (e.g. /directory and /directory. Defaults to true

Example

var serve = require('koa-static-security');
var koa = require('koa');
var app = koa();

// $ GET /package.json
app.use(serve('.'));

// $ GET /hello.txt
app.use(serve('test/fixtures'));

// or use absolute paths
app.use(serve(__dirname + '/test/fixtures'));

app.listen(3000);

console.log('listening on port 3000');

License

MIT

Keywords

koa

FAQs

Package last updated on 29 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts