A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/koajs/file-server below:

koajs/file-server: file serving middleware for koa

An opinionated file server. Designed to sit behind a CDN.

Does not support:

var app = require('koa')()
app.use(require('compress')())
app.use(require('koa-file-server')(options))

Options are:

var file = yield* send(this, [path])
var send = require('koa-file-server')(options).send

serve.send() allows you to serve files as a utility. This is helpful for arbitrary paths. The middleware also adds var file = yield* this.fileServer.send(path).

path defaults to this.request.path.slice(1), removing the leading / to make the path relative.

For an example, see the middleware's source code.

var file = yield* push(this, path, [options])
var push = require('koa-file-server')(options).push

Optionally SPDY Push a file. The middleware also adds var file = yield* this.fileServer.send(path, [opts]).

Unlike send(), path is required. path must also be a relative path (without a leading /) relative to the root. The push stream's URL will be '/' + path. Errors will be thrown on unknown files. The only option is priority: 7.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4