Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed up example to work again... Also fixed and updated lib to use s…
…tartNext instead of just next. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
- Loading branch information
Showing
2 changed files
with
15 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
var Queue = require('../lib/queuestream').QueueStream(), | ||
fs = require('fs'); | ||
|
||
stream.on('error', function(err) { | ||
Queue.on('error', function(err) { | ||
console.log('err: ' + err); | ||
}); | ||
|
||
stream.on('data', function(data) { | ||
console.log(data.toString()); | ||
Queue.on('data', function(data) { | ||
console.log('listener 1: ' + data.toString()); | ||
}); | ||
Queue.on('data', function(data) { | ||
console.log('listener 2: ' + data.toString()); | ||
}); | ||
Queue.on('data', function(data) { | ||
console.log('listener 3: ' + data.toString()); | ||
}); | ||
|
||
stream.on('end', function() { | ||
Queue.on('end', function() { | ||
console.log('done'); | ||
}); | ||
|
||
var test1 = fs.createReadStream(__dirname + '/files/test1.txt'); | ||
stream.queue(test1); | ||
Queue.queue(test1); | ||
var test2 = fs.createReadStream(__dirname + '/files/test2.txt'); | ||
stream.queue(test2); | ||
Queue.queue(test2); | ||
|
||
stream.start(); | ||
Queue.startNext(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters