Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kinesis-client

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kinesis-client

A tiny Kinesis client library

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Kinesis Client

A very minimal functional wrapper around the AWS SDK to provide a Kinesis Client. I'll extend as necessary.

The idea here is that the kinesis require functions more like a namespace containing functions than as an object.

NOT PRODUCTION READY

Usage

To use in a lambda, do something like the below:

const kinesis = require('kinesis-client');

const defaultOpts = () => {
  return defaultOpts = {
    endpoint: 'localhost:4567',
    region: 'us-east-1',
    apiVersion: '2013-12-02',
    sslEnabled: false
  };
};

module.exports.source = (event, context, callback) => {
  const kinesisClient = kinesis.createClient(defaultOpts);
  var streamName = 'events';
  var streamOpts = { ShardCount: 1, StreamName: streamName }
  var callbackFn = function (err, data) { 
    if (err) {
      callback(err, {statusCode: 500, body: "Error writing to stream"});
    }
    else { 
      callback(null, {statusCode: 202, body: "ok" });
    }
  }

  kinesis.createStream(kinesisClient, streamOpts);

  console.log(event.body);

  kinesis.putRecord(kinesisClient,
                    {
                     Data: JSON.stringify(event.body),
                     PartitionKey: '0', // change this!
                     StreamName: streamName
                    },
                    callbackFn);
};

TODO

Add more tests!

Licence

MIT

FAQs

Package last updated on 30 May 2018

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