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 🙏

© 2024 – Pkg Stats / Ryan Hefner

localsqs

v0.1.0

Published

A basic CLI wrapper for ElasticMQ designed for mocking SQS locally.

Downloads

5

Readme

localsqs

A basic CLI wrapper for ElasticMQ designed for mocking SQS locally.

Table of contents

Overview

localsqs is a command-line tool for interacting with ElasticMQ, which provides a local, in-memory implementation of Amazon SQS. It allows developers to test and mock SQS behavior locally without needing AWS infrastructure.

This tool uses the ElasticMQ REST API to interact with queues, send and receive messages, and manage queue attributes.

Usage

npx localsqs --help

You can use the CLI with the command npx localsqs.

Commands <required arg> [optional arg]

  • up: Start ElasticMQ in Docker.

    Options:

    • --api-port (default: 9324): Port for the REST-SQS API.
    • --ui-port (default: 9325): Port for the UI.
    • --force or -f: Forcefully terminate processes occupying specified ports before starting.
  • createQueue <queueName>: Create a new SQS queue.
  • deleteQueue <queueName>: Delete a specified queue.
  • listQueues [namePrefix]: List all queues or filter by prefix.
  • purgeQueue <queueName>: Purge all messages from a specified queue.
  • send <queueName> [messageBody]: Send a message to a queue. You can provide messageBody as a JSON string or pipe JSON data.

    Options:

    • --sns: Will wrap the payload in a SNS-like message format.
  • receive <queueName>: Receive messages from a specified queue.
  • getQueueUrl <queueName>: Get the URL for a specified queue.
  • getQueueAttributes <queueName>: Retrieve attributes of a queue.

💡 Type --help after any command to see the available options.

Examples

Start ElasticMQ

npx localsqs up
With custom ports
npx localsqs up --api-port 9334 --ui-port 9335 --force

Create a queue

npx localsqs createQueue myQueue

Send a message

npx localsqs send myQueue "hello world" --sns
With piped input
cat message.json | npx localsqs send myQueue --sns

Read the messages in a queue

npx localsqs receive myQueue

List all queues

npx localsqs listQueues

Configuration

The tool defaults to connecting to ElasticMQ on http://127.0.0.1:9324 for the API and http://127.0.0.1:9325 for the UI.

💡 Use the --api option on a command to override the default API URL.

Error handling

localsqs uses fetch for API requests.

A common error is ECONNREFUSED, which may occur if ElasticMQ is not running or if there is an issue with the specified API port. Non-200 HTTP responses from ElasticMQ will also trigger errors.

Development

  1. Clone the repository and install dependencies.
  2. Build the project:
    npm run build
  3. Link the project for CLI testing:
    npm link
  4. You can now use localsqs as a command.