Gathering detailed insights and metrics for koa-files
Gathering detailed insights and metrics for koa-files
npm install koa-files
Typescript
Module System
Min. Node Version
Node Version
NPM Version
65.5
Supply Chain
96.9
Quality
83.3
Maintenance
100
Vulnerability
100
License
TypeScript (79.17%)
JavaScript (20.83%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
12,048
Last Day
8
Last Week
22
Last Month
149
Last Year
3,577
MIT License
8 Stars
351 Commits
1 Watchers
3 Branches
1 Contributors
Updated on Feb 26, 2025
Minified
Minified + Gzipped
Latest Version
4.0.1
Package Id
koa-files@4.0.1
Unpacked Size
59.90 kB
Size
14.54 kB
File Count
35
NPM Version
10.9.0
Node Version
22.12.0
Published on
Dec 20, 2024
Cumulative downloads
Total Downloads
Last Day
14.3%
8
Compared to previous day
Last Week
-4.3%
22
Compared to previous week
Last Month
-35.5%
149
Compared to previous month
Last Year
129.1%
3,577
Compared to previous year
3
1
A static files serving middleware for koa.
1$ npm install koa-files
1import { Middleware } from 'koa'; 2import fs, { Stats } from 'node:fs'; 3 4interface Headers { 5 [key: string]: string | string[]; 6} 7 8interface IgnoreFunction { 9 (path: string): boolean | Promise<boolean>; 10} 11 12interface HeadersFunction { 13 (path: string, stats: Stats): Promise<Headers | void> | Headers | void; 14} 15 16export interface FileSystem { 17 stat: typeof fs.stat; 18 open: typeof fs.open; 19 read: typeof fs.read; 20 close: typeof fs.close; 21} 22 23export interface Options { 24 fs?: FileSystem; 25 defer?: boolean; 26 etag?: boolean; 27 acceptRanges?: boolean; 28 lastModified?: boolean; 29 highWaterMark?: number; 30 ignore?: IgnoreFunction; 31 headers?: Headers | HeadersFunction; 32} 33 34export function server(root: string, options?: Options): Middleware;
fs
node:fs
.defer
false
.await next()
.etag
true
.headers
.acceptRanges
true
.headers
.lastModified
true
.headers
.highWaterMark
65536
(64 KiB).ignore
undefined
.headers
undefined
.1/** 2 * @module server 3 * @license MIT 4 * @author nuintun 5 */ 6 7import Koa from 'koa'; 8import { server } from 'koa-files'; 9 10const app = new Koa(); 11const port = process.env.PORT || 80; 12 13// Static files server 14app.use( 15 server('tests', { 16 headers: { 17 'Cache-Control': 'public, max-age=31557600' 18 } 19 }) 20); 21 22/** 23 * @function httpError 24 * @param {NodeJS.ErrnoException} error 25 * @returns {boolean} 26 */ 27function httpError(error) { 28 return /^(EOF|EPIPE|ECANCELED|ECONNRESET|ECONNABORTED)$/i.test(error.code); 29} 30 31// Listen error event 32app.on('error', error => { 33 !httpError(error) && console.error(error); 34}); 35 36// Start server 37app.listen(port, () => { 38 console.log(`> server running at: 127.0.0.1:${port}`); 39});
Support multipart range and download resumption.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
packaging workflow detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-02-17
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More