npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dynamodb-subscriber

v1.1.2

Published

Subscribe to DynamoDB streams easily.

Readme

Subscribe to DynamoDB streams easily.

Installation

npm i dynamodb-subscriber --save

Usage

DynamoDBSubscriber allows you to watch the events happening since you start to watch. In the AWS stream API this is ShardIteratorType: 'LATEST'.

const DynamoDBSubscriber = require('dynamodb-subscriber');

const subscriber = new DynamoDBSubscriber({
  arn: 'arn:aws:dynamodb:us-west-1:XXXX:table/YYYY/stream/ZZZZ',
  interval: '1s',
});

subscriber.on('record', (record, keys) => {
  console.log('entire record:')
  console.dir(record)
  console.log('key:')
  console.dir(keys)
});

subscriber.start();

Example output:

entire record:
{ eventID: 'xxxxx',
  eventName: 'INSERT',
  eventVersion: '1.1',
  eventSource: 'aws:dynamodb',
  awsRegion: 'us-west-1',
  dynamodb:
   { ApproximateCreationDateTime: Fri Aug 05 2016 16:43:00 GMT-0300 (ART),
     Keys: { name: { S: 'YYYYZZZ' } },
     SequenceNumber: '4324698400043243243243246',
     SizeBytes: 35,
     StreamViewType: 'KEYS_ONLY' } }

key:
{ name: 'YYYYZZZ'
}

You can also initialize with the name of the table like this:

const subscriber = new DynamoDBSubscriber({
  table: 'my-dynamodb-table',
  interval: '1s',
});

The constructor parameters are:

  • arn: the ARN of the resource. Copy this from the AWS console.
  • interval (optional): it can be either a number of milliseconds or an string indicating an interval to poll (syntax from ms).

Events:

  • record: emitted when a new record is pull from the stream.
  • error: when the AWS API return an error.

Methods:

  • start: start to poll the shards periodically.
  • stop: stop watching the stream.

Stream interface

In addition to the EventEmitter there is a way to create a readable stream with this module.

const DynamoDBStream = require('dynamodb-subscriber').Stream;

const dynamoDbStream = new DynamoDBStream({
  arn: 'arn:aws:dynamodb:us-west-1:XXXX:table/YYYY/stream/ZZZZ',
  interval: '1s',
});

dynamoDbStream.pipe(stringify).pipe(process.stdout);

IAM

In order to use this module you need the following permissions on the stream resource:

  • dynamodb:DescribeStream
  • dynamodb:GetShardIterator
  • dynamodb:GetRecords

Additionally, if you initialize with table name instead of arn, we need either of these two:

  • dynamodb:ListStreams on the stream arn
  • dynamodb:DescribeTable on the table itself

License

MIT 2016 - José F. Romaniello. See the License file on this repository.