Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
koa-file-server
Advanced tools
Readme
An opinionated file server. Designed to sit behind a CDN.
sha256
etags and consequential 304sfs.stat()
callsindex.html
filesDoes not support:
var app = require('koa')()
app.use(require('compress')())
app.use(require('koa-file-server')(options))
Options are:
root
<process.cwd()> - root directory. nothing above this root directory can be servedmaxage
- cache control max ageetag
- options for etags
algorithm
- hashing algorithm to useencoding
- encoding to useindex
- serve index.html
fileshidden
- show hidden files which leading .
svar 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 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
.
FAQs
file serving middleware for koa
We found that koa-file-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).