koa-lite/examples/streams.js

13 lines
214 B
JavaScript

var koa = require('..');
var fs = require('fs');
var app = koa();
// try GET /streams.js
app.use(function *(){
var path = __dirname + this.path;
this.body = fs.createReadStream(path);
});
app.listen(3000);