JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 83643
  • Score
    100M100P100Q164525F
  • License MIT

TypeScript definitions for koa-compress

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/koa-compress) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/koa-compress

    Summary

    This package contains type definitions for koa-compress (https://github.com/koajs/compress).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-compress.

    index.d.ts

    /* =================== USAGE ===================
    
        import compress = require("koa-compress");
        var Koa = require('koa');
    
        var app = new Koa();
        app.use(compress());
    
     =============================================== */
    /// <reference types="node" />
    /// <reference types="koa" />
    
    import Koa = require("koa");
    import * as zlib from "zlib";
    
    /**
     * Compress middleware for Koa
     */
    declare function koaCompress(options?: koaCompress.CompressOptions): Koa.Middleware;
    
    declare namespace koaCompress {
        export interface CompressOptions {
            /**
             * An optional function that checks the response content type to decide whether to compress. By default, it uses compressible.
             */
            filter?: ((mimeType: string) => boolean) | undefined;
    
            /**
             * Minimum response size in bytes to compress. Default 1024 bytes or 1kb.
             */
            threshold?: number | string | undefined;
    
            /**
             * An optional string, which specifies what encoders to use for requests
             * without Accept-Encoding. Default: 'idenity'.
             */
            defaultEncoding?: string | undefined;
    
            /**
             * Options for brotli compression.
             */
            br?: zlib.BrotliOptions | false | undefined;
    
            /**
             * Options for gzip compression.
             */
            gzip?: zlib.ZlibOptions | false | undefined;
    
            /**
             * Options for deflate compression.
             */
            deflate?: zlib.ZlibOptions | false | undefined;
        }
    }
    
    export = koaCompress;
    

    Additional Details

    Credits

    These definitions were written by Jerry Chin, and Joel Gallant.