Notable Pseudocode Mashups
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    ex-staticpublic

    ex-static

    Serves files. It's pretty fast.

    To use:

    var http = require('http');
    var static = require('ex-static');
     
    var files = [
        {url: '/', path: 'static/index.html'},
        {url: '/test.jar', path: 'static/test.jar', type: 'application/java-archive', cache: 300000, compress: true}
    ];
     
    http.createServer(static(files)).listen(80);
    • cache - Sets the number of seconds on the Cache-Control: max-age header. Using 0 sets no header.
    • type - Used to specify a Content-Type, or override the default type associated with the file extension.
    • compress - Set whether we should use compression. Small files have it on by default.
    • stream - True if the file should be streamed to the client, false if it should be written in one chunk. Defaults to true for small files.
    • path - The local file path where the file can be found.
    • url - The url where the file should be served.

    All files have ETag values that are the MD5 hashes of their contents.

    Small files are compressed with gzip for browsers that support it. To override the default compression setting for a file, use the compress parameter.

    Keywords

    none

    install

    npm i ex-static

    Downloadsweekly downloads

    12

    version

    0.4.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar