stream-res

Pipe a stream to an HTTP response

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
stream-res
1.0.16 years ago6 years agoMinified + gzip package size for stream-res in KB

Readme

stream-res Build Status
Pipe a stream to an HTTP response

Installation

$ npm i stream-res --save

Usage

var fs = require('fs');
var streamRes = require('stream-res');

app.get('/', function(req, res, next) {
    var stream = fs.createReadStream('./test.html');

    streamRes(res, stream, function(err) {
        if (err) next(err);
        else {
            console.log('file test.html has been piped to client');
        }
    });
});