Socket
Socket
Sign inDemoInstall

@coffeekraken/s-stdio

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coffeekraken/s-stdio

Clean and extensible Stdio system that make use of the @coffeekraken/s-event-emitter event system to listen to "log" or "ask" events and display them nicely with our built-in terminal implementation or anywhere else if you extends it.


Version published
Maintainers
1
Created
Source

{{#> layout-readme }}

Easy and powerful IO interface

This package allows you to display processes/webpages logs with ease. Here's some of the features available:

  • SBasicStdio: Nice IO interface for terminal
  • Event based log system
  • Filtrable output depending on log type
  • Extensible IO system for things like websockets, etc...
  • And more...

Usage

Here's how to use our implementation:

import __SStdio from '@coffeekraken/s-stdio';
import spawn from '@coffeekraken/sugar/node/process/spawn';
const proc = spawn('ls -la');
__SStdio.new(__SStdio.UI_BASIC, proc);

How it works

The SStdio class will listen for some events log and ask. Once one of these events is triggered, the IO will either display a log, or the asked question using different implementations depending on the SStdio instanciated type.

The event are listened using the SEventEmitter class.

Here's an example of emitting a log event that will be handled by the SStdio instance:

import __SPromise from '@coffeekraken/s-promise';
import __SLog from '@coffeekraken/s-log';

export default function myProcess() {
    return new __SPromise(({ resolve, reject, emit }) => {
        // do something...
        emit('log', {
            type: __SLog.TYPE_INFO,
            value: 'Hello world from my cool process',
        });
        // do something...
        resolve();
    });
}

Note that the SPromise class extends the SEventEmitter one.

Settings

{{> interface namespace='@coffeekraken.s-stdio.shared.interface.SStdioSettingsInterface' }}

API

For more information about the API of this class, please check our API documentation

{{/ layout-readme }}

FAQs

Package last updated on 16 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc