# slish

> Real time, extendable file monitor

Latest version **0.5.0** (published 2015-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install slish
pnpm add slish
yarn add slish
bun add slish
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2015-12-10 |
| First published | 2015-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Tomas Longo |
| Maintainers | tlongo |
| Keywords | filemonitoring tail file |

## Links

- npm: https://www.npmjs.com/package/slish
- Repository: https://github.com/TomasLongo/slish
- Issues: https://github.com/TomasLongo/slish/issues
- npm.io page: https://npm.io/package/slish

## Recent versions

- 0.5.0 (latest) — 2015-12-10
- 0.4.0 — 2015-11-18

## README

# 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](http://www.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)
~~~js
/**
  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();

~~~

---
_Source: https://npm.io/package/slish · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
