http-playback

1.1.2 • Public • Published

http-playback

Playback a file's contents over HTTP, at a configurable speed. Useful for simulating live data streams with canned inputs.

Install

Install as a dependency to a project:

npm install --save http-playback

Install CLI tool globally:

npm install --global http-playback

Using the command-line tool

http-playback --port 8080 --chunk-size 32 --delay 500 --filename sample.file

Test with curl:

curl -vN http://localhost:8080

Programmatic Use

You can also use http-playback in your own code:

var httpPlayback = require('http-playback');
 
var buffer = ...;
 
var options = {
  port: 8080,
  buffer: buffer, // you can provide your own buffer, or...
  filename: '/path/to/file',
  chunkSize: 32, // size, in bytes, of chunks
  delay: 500 // delay, in milliseconds, between sending chunks
};
 
httpPlayback(options, function (err, server) {
  // kill server after a delay
  setTimeout(function () {
    server.close();
  }, 5000);
});

License

MIT license. See LICENSE file.

Readme

Keywords

Package Sidebar

Install

npm i http-playback

Weekly Downloads

8

Version

1.1.2

License

MIT

Last publish

Collaborators

  • sokhealy
  • pcswiftnav
  • snav
  • ljbade
  • ebethon
  • snav-jason