Giter Club home page Giter Club logo

slish's Introduction

Slish - Realtime Streaming of File Content

Slish takes new content of a file as soon as it arrives and is able to distribute it to multiple consumers.

Consumers can be the console or a database, a remote service or simply another file.

Consumer must conform to a simple interface and provide a method consume that takes in the file content that will be provided by Slish. The stage is yours from that point on.

Features

  • Easy to use API. Start to stream is a matter of creating a Slish instance and call startStreaming on it.
  • Slish makes it easy to create custom consumers. Just provide an object with a method consume(newData) where newData is the new file content detected by Slish and you're ready to go.
  • Ships with three ready to use consumers
    • ConsoleConsumer: Simply pass new content to stdout
    • ColoredConsumer: Colors new content line-by-line based on configured patterns
    • SocketConsumer: Sends new content over to remote clients connecting via socket.io

Consumers

The consumers folder contains a separate package.json file to manage the dependencies of the consumers.

Working Example (taken from the examples folder)

/**
  Showcases how to use Slish to observe a file.
 */
var Slish = require('slish');
var ConsoleWriter = require('consumers/consoleconsumer');
var ColoredWriter = require('consumers/coloredconsumer')
var path = require('path');

var slish = new Slish(process.argv[2]);
var consumer = new ColoredWriter();

// The pattern is built in Slish and can be accesed by name
consumer.setActivePattern('Winston');

// Adds the colored to the output channels
slish.addConsumer(consumer);

console.log('start streaming');

// Starts obserrving the file
slish.startStreaming();

slish's People

Contributors

tomaslongo avatar

Stargazers

Aditya Bhardwaj avatar

Watchers

James Cloos avatar  avatar

Forkers

purezen

slish's Issues

Create consumer to store content to mongo db

A new consumer, that handles storing new file Content to mongoDB
Thoughts:

  • Consumer has to process new content and serialize it into a json object which is than persisted into mongo
  • Use mongoose?
    • Especially useful for creating custom Schemas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.