Save stream contents and pipe it again later.
var save = require('save-stream');
var saved = save();
saved.write(1);
saved.write(2);
saved.write(3);
saved.write(4);
saved.end();
saved.load().pipe(console.log);
setTimeout(function () {
saved.load().pipe(console.log);
}, 1000);
/* Output:
1
2
3
4
1
2
3
4
*/Returns pass through stream with additional method
Returns pass through stream, that will emit all data from the begining.
Note: it may change to 1.0.0 version, because initialy I wanted just overload pipe method.
MIT (c) 2014 Vsevolod Strukchinsky