I have a NodeJS stream.Readable, ArticleReader. It's job is to read articles, Meantime I have to give it a date to signify the date of the articles, say the default date is today, now I start reading with .on('data')
event, and the stream ends. Later I want to change the date and start reading yesterday's articles, In what way I should implement this stream.Readable so this is possible.
One way to think about this is, construct a new ArticleReader for each date. Is this a good approach or is there a better way?
Here's a sample implemtation for reference.
var async = require('async'),
util = require('util'),
ReadableStream = require('readable-stream').Readable;