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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nielskrijger/sns

v0.1.0

Published

Basic wrapper for Node.js AWS SNS driver

Readme

SNS

A wrapper for AWS SNS, providing promises and a set of convenience methods.

NOTE: this library is not very customizable nor will it be, its intent is to serve as a standard for my personal projects. There are only few tests because its use is extensively tested in component tests.

init(options)

Run init(options) before executing any statements.

import * as sns from '@nielskrijger/sns';

sns.init({
  region: 'eu-west-1',
});

Other connection options can be found in the AWS SNS documentation.

getArn(topicName)

Returns a promise with the topic ARN of specified topicName. Returns null when not found.

Caches the results and returns the same result every time thereafter.

sns.getArn('my-topic').then((arn) => {
  console.log(arn); // arn:aws:sns:eu-west-1:1234567890:my-topic
});

createTopic(topicName)

Ensures the SNS topic exists and returns its topic ARN.

sns.createTopic('my-topic').then((topicArn) => {
  console.log(topicArn); // arn:aws:sns:eu-west-1:1234567890:my-topic
});

publish(topicName, message)

Publishes a message to a SNS topic and returns the AWS response. The message body is converted to JSON.

const body = {
  action: 'deleteUser',
  user_id: 'a4bl35gsl'
};
sns.publish('my-topic', body).then((messageId) => {
  console.log(messageId); // Contains `MessageId` of published message
});

subscribeSqs(topicName, queueArn)

Subscribes an SQS queue to an SNS topic.

sns.subscribeSqs('my-topic', 'arn:aws:sqs:eu-west-1:1234567890:my-queue').then((result) => {
  console.log(result); // Contains AWS response
});

Logging

import * as sns from '@nielskrijger/sns';

sns.on('log', (level, message, object) => {
  console.log(`Log event: ${level}, ${message}, ${object}`);
});

The library returns log messages with levels debug, info and error.