stream-simple
v0.2.0
Published
Readable to Simple stream converter
Downloads
2
Readme
#stream-simple
This project is an util for converting node readable streams to simple-stream format suggested by Tim Caswell.
##Example
http echo server
var Simple = require('stream-simple')
var http = require('http')
http.createServer(function(req, res) {
var body = Simple(req)
res.on('error', function() {
body.abort()
})
res.writeHead(200, {
'Content-Type': req.headers['content-type']
})
;(function read() {
body.read(function(err, chunk) {
if (err) return res.destroy()
if (!chunk) return res.end()
res.write(chunk)
read()
})
})()
})
##Installation
via npm
npm install stream-simple
##License
MIT