v0.0.2Published 8 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.


Record and live stream streams (stdout/stderr/anything) to the browser

Copyright (c) 2016 by Gadi Cohen, released under GPLv3.


On the Server

Method 1: passing a stream

1var ms = new MongoStream({
2  id: 'uniqueId'  // optional.  generated if not given at ms._id
3  stdout: child_process.stdout,
4  stderr: child_process.stdin

Method 2: piping

1var ms = new MongoStream();

On the Client


{{>mongoStream id=id}}


How it works

Under the hood this relies on Mongo and Blaze. The truth is Meteor's original core is much better for this (right now) than Relay / React, etc. But we do supply a React wrapper.

Long term there could be a better way, but we did specifically want to retrieve the stream at a later point (i.e. to view log files), so storing in a database too was a design decision.

Each chunk received is stored as a separate doc in the mongoStream collection. Carriage returns (\r) are merged into the most recent doc. ANSI colors are converted to HTML.


Log retrieval

Currently the only security is to rely on knowing the unique ID.

Log display

'<' etc characters are escaped, so in theory, no unsafe HTML should ever be presented.