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

@creative-realities/cutie

v3.1.3

Published

Package for AWS SQS.

Readme

An AWS SQS package

Setting Up SQS

First configure your SQS queue on AWs. Cutie is a minimalist package, so configure your queue's default values to what you want in the AWS interface (cutie does not provide an interface for this).

Please note:

  • Cutie only processes one message at a time, so your queue should be set up for one message at a time.
  • Cutie does not have an interface for configuring credentials. You must set this up through AWS roles.
  • Cutie expects your queue to be configured with a Default Visibility Timeout of 2 minutes.

Setting up cutie

var Cutie = require("cutie");
var options = {
	verbose: true, // defaults to false
};
var cutie = new Cutie("http://queue.url.whatever"); // URL from AWS

Adding tasks

Messages sent to cutie require a task property. This tells cutie which previously added task to perform. The task callback receives the message object and a done callback. Task callbacks must always call the done method within 2 minutes, which it expects to be the Default Visibility Timeout of your queue. See the Changing the Timeout section if you need to extend the timeout. It is very important that every code path in your task always completes by calling the done callback. The done callback takes an error parameter. If you pass an error parameter to the done callback, cutie will not remove the message from the SQS queue; it will remain in the queue to be reprocessed.

cutie.addTask("userRegistrationNotification", function(message, done) {
	// message is the object passed to send.
	var user = message.user;
	
	// Do stuff in some async method...
	asyncMethod(user, function(err) {
    	if (err)
        	return done(err); // message will NOT be removed from queue
        
        done(); // message will be removed from queue
	});
});

Start polling

cutie.start();

Sending messages to queue

// The send method will continue to retry up to 100 times if send fails when no callback is provided.
cutie.send({
	task: "userRegistrationNotification",
	user: user
});

// If you provide a callback and optional context, cutie will not retry to send.
cutie.send(message, function(error, data) { /* Do stuff */ }, this);

Sending message batch to queue

cutie.send([
	{
		task: "userRegistrationNotification",
		user: user1,
	},
	{
		task: "userRegistrationNotification",
		user: user2,
	}
	// ... etc.
]);

// When an array parameter is passed in, cutie acutally calls sendBatch(batch [, callback, context])

Changing the Timeout

Task callbacks will recieve a third object parameter that includes the changeTimeout method. Calling changeTimeout will extend the time that cuite and SQS allow for the task to complete. SQS will not make the message available again, until the new timeout interval has elapsed. This should be done at the very beginning of your callback. In the example, we'll give the task 10 minutes to complete which we pass in as seconds.

cutie.addTask("userRegistrationNotification", function(message, done, options) {
	var taskTimeoutSeconds = 10 * 60;
	options.changeTimeout(taskTimeoutSeconds);
	// Do other stuff...
});

Multiple queues

As of 3.0 cutie can be configured with multiple queues in order of priority. When ready to process a new message, cutie checks the queues in order of priority.

Configuring

To configure cutie to check multiple queues in order of priority, pass an array of queue URLs sorted by priority where the highest priority is at index zero.

var cutie = new Cutie(["http://queue.url.priority", "http://queue.url.normal"]); // URL from AWS

Sending

The send method takes an optional priority parameter, which should match the index into the array of priority sorted queues. Cutie will limit the range of the priority argument to valid array indices instead of giving an error, so if you pass in a priority 2 and the array only has one queue at index 0, it will use index 0. If you omit the priority argument index 0 will always be used.

var priorityQueueIndex = 0;
var normalQueueIndex = 1;

cutie.send(normalQueueIndex, message);

Task locking

// Assuming your callback parameter is named done, you may indicate that a task cannot be completed,
// but needs to be tried later and is not a real error to be logged like this:

if (taskIsLocked)
	return done({cutieMessage: "Task Locked"});