https://github.com/gadicc/meteor-mongo-stream
Live streaming of (recorder) streams (stdout/stderr/anything) to the browser
https://github.com/gadicc/meteor-mongo-stream
Last synced: about 1 year ago
JSON representation
Live streaming of (recorder) streams (stdout/stderr/anything) to the browser
- Host: GitHub
- URL: https://github.com/gadicc/meteor-mongo-stream
- Owner: gadicc
- Created: 2016-03-23T15:17:00.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-10T09:09:10.000Z (about 10 years ago)
- Last Synced: 2025-02-17T21:19:07.630Z (over 1 year ago)
- Language: JavaScript
- Size: 73.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MongoStream
*Record and live stream streams (stdout/stderr/anything) to the browser*
Copyright (c) 2016 by Gadi Cohen , released under GPLv3.
## Usage
### On the Server
#### Method 1: passing a stream
```js
var ms = new MongoStream({
id: 'uniqueId' // optional. generated if not given at ms._id
stdout: child_process.stdout,
stderr: child_process.stdin
});
```
#### Method 2: piping
```js
var ms = new MongoStream();
child_process.stdout.pipe(ms.stdout);
```
### On the Client
#### Blaze
{{>mongoStream id=id}}
#### React
## 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.
## Security
### 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.