Socket
Book a DemoInstallSign in
Socket

kcl-readable-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kcl-readable-stream

Make a KCL object work as a readable stream

0.2.0
latest
Source
npmnpm
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

kcl-readable-stream

Build Status

This project convert a KCL object into a readable stream.

There are three (optional) options that can be used in the constructor:

  • kcl.initialize: Will be called with data and callback when the KCL subprocess is initialized. The callback function must be called.
  • kcl.shutdown: Will be called with data and callback when the KCL subprocess is shut down because of an error or if the process is stopped. The callback function must be called.
  • kcl.streamSingleRecords: If true, data events will be emitted with single records; otherwise, an array of records will be used. Defaults to false.

Example usage

// run this with something like:
// `kcl-bootstrap --java /usr/bin/java -e -p ./conf/kinesis.properties`

const kcl = require('aws-kcl');
const KclReadableStream = require('kcl-readable-stream');

const kclProcessor = new KclReadableStream({
  kcl: {
    initialize: (data, callback) => {
      console.log('Initialized!');
      callback();
    },
    shutdown: (data, callback) => {
      console.log('Shutdown!');
      callback();
    },
    streamSingleRecords: false
  }
});

// if !streamSingleRecords
kclProcessor.on('data', (records) => {
  console.log('This is an array of records: ', records);
});

// if streamSingleRecords === true
kclProcessor.on('data', (record) => {
  console.log('This is a single record: ', record);
});

// you can also .pipe()
kclProcessor.pipe(process.stdout);

kcl(kclProcessor).run();

Keywords

kcl

FAQs

Package last updated on 20 May 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.