stream-res

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i stream-res

Weekly Downloads

131

Version

1.0.1

License

Apache-2.0

Last publish

Collaborators

  • samypesse