A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/claudetech/koa-stream below:

claudetech/koa-stream: Send file with range requests

Helper to stream files and buffers with range requests using koa. This can be used with video tags, and other resource using the Range header.

The implementation follows RFC 7233.

var stream = require('koa-stream');
var path   = require('path');
var app    = require('koa');

app.use(function *() {
    yield stream.file(this, 'my-video.mp4', {root: path.join(__dirname, '/public')});
});
var stream = require('koa-stream');
var path   = require('path');
var app    = require('koa');

app.use(function *() {
    stream.buffer(this, new Buffer([1,2,3]), 'image/png', {allowDownload: true});
});

See sample/index.js for a working example.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4