0.2.1 • Published 11 years ago

future-stream v0.2.1

Weekly downloads
1
License
-
Repository
github
Last release
11 years ago

future-stream

Delay the emission of stream events until a future condition is true

build status

Installation

This module is installed via npm:

$ npm install future-stream

Example Usage

This example delays the streaming of a file to stdout by 1 second.

var futureStream = require('future-stream');
var fs = require('fs');

function makeStream() {
  return fs.createReadStream('/etc/passwd', { encoding: 'utf8' });
}

var start = Date.now();
function condition() {
  // true after 1 second
  return (Date.now() - start) > 1000;
}

var s = futureStream(makeStream, condition);
s.pipe(process.stdout);
0.2.1

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago

0.0.1

11 years ago