1.3.0 • Published 3 years ago
koa-range-static v1.3.0
koa-range-static
Static file server middleware, support for multipart ranges request
Install
npm i koa-range-staticExample
const Application = require("koa");
const { rangeStatic } = require("koa-range-static");
const app = new Application();
app.use(rangeStatic({ root: ".", directory: true }));
app.listen(3000);API
// rangeStatic
const { rangeStatic } = require("koa-range-static");
app.use(rangeStatic(rangeStaticOptions));
// send
const { send } = require("koa-range-static");
app.use(async (ctx) => {
await send(ctx, ctx.path, sendOptions);
});rangeStatic options
directoryShow directory, conflict withformat. Default isfalserenderDirentRender directory entries.- For others, see
send options
send options
delayDelay sending each chunk. Default is0formatIf not false, format the path to serve static file servers and not require a trailing slash for directories, so that you can do both /directory and /directory/. Default isfalsehiddenAllow transfer of hidden files and show hidden directory. Default isfalseimmutableTell the browser the resource is immutable and can be cached indefinitely. Default isfalseindexName of the index file to serve automatically when visiting the root location. Default is"index.html"maxageBrowser cache max-age in seconds. Default is0multipartEnable multipart ranges. Default istruerootRoot directory to restrict file access. Default isresolve()getBoundaryParamBoundary parameter required for multipart ranges requests. Default is a random value of length 12
License
MIT