1.0.1 • Published 9 years ago

stream-res v1.0.1

Weekly downloads
683
License
Apache-2.0
Repository
-
Last release
9 years ago

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');
        }
    });
});